Skip to content

Conversation

@dkuegler
Copy link
Member

@dkuegler dkuegler commented Nov 9, 2023

To address incorrect etiv estimates, several changes to the bias field estimation and the pipeline are implemented

  • use the white matter mask of the aseg to identify the rescaling slope so images have a predefined white matter intensity.
  • add ifh2hdr from Freesurfer to the docker image (used by talairach_avi)
  • change the directory the bashrc is written to in the docker image
  • general cleanup and formatting of n4_bias_correct.py
  • add overloads to image_io.py
  • fix python-s reference when it does not exist (the idea is that in the docker, packages from user-space , so a mounted home directory, should never be used)

Addresses #378 .

fix python-s in run_fastsurfer.sh (only use this if it is defined, else use python3.10 -- this is the default value and the in-docker fix to ignore user-space packages)
fix bashrc definition in Docker/Dockerfile
rewrite/update N4_bias_correct.py
- accept additional parameters (--aseg, --verbosity, --version)
- port from optparse to argparse
- change printing to logging facilities (instead of print), verbosity changes amount of prints.
- rename functions and variables to follow PEP8 (lowercase, underscore to separate)
- add function and integration to process the aseg and calculate wm intensity based on the wm segmentation from aseg
- change normalization code to keep the zero-base (robust scaling should be done previously, e.g. typically in conforming)
- rearrange code structure so functions are not as dependent on flags. Specifically, whether or not specific flags/files are present is moved to the main script. Consequently, functions are more predictable and not dependent on arguments.
@dkuegler dkuegler mentioned this pull request Nov 9, 2023
@dkuegler
Copy link
Member Author

@m-reuter The call to N4_bias_correct was in fact wrong.
I fixed that now. I tested the script not with the run_fastsurfer.sh script, but directly that script, so it should still be correct, it just means, that my tests/validation for the etiv values and the PV-effects are based on the wrong script...
using --mask was a version that I considered, but then I changed it again because it was potentially confusing and not clear.

So, unfortunate... It is going to delay any new release...

change the renormalization (--skipwm mode) to only consider the average intensity of the masked image.
fix docstring in image_io.py
@m-reuter m-reuter merged commit f8373ae into Deep-MI:dev Nov 15, 2023
@dkuegler dkuegler deleted the fix/talairach branch November 16, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants