Deep-MI/FastSurfer

conforming adding header info

Opened this issue · 1 comments

Description

When conforming happens from inside run_prediction it adds incorrect "TR" information to the image header.

Steps to Reproduce

Run run_prediction with an already conform input, e.g. from oasis and compare the conformed output image.
mri_info will show on the original:
TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees
and on the conformed:
TR: 1000.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees
So acquisition parameters change, while the image is identical (no conforming necessary as it is already).

Expected Behavior

Copy those values from the original header.

Environment

  • FastSurfer Version: dev
  • OS: macos

absl-py==2.1.0
certifi==2024.8.30
charset-normalizer==3.3.2
click==8.1.7
contourpy==1.3.0
cycler==0.12.1
Deprecated==1.2.14
filelock==3.16.0
fonttools==4.53.1
fsspec==2024.9.0
grpcio==1.66.1
h5py==3.11.0
humanize==4.10.0
idna==3.8
imageio==2.35.1
Jinja2==3.1.4
joblib==1.4.2
kiwisolver==1.4.7
lapy==1.1.1
lazy_loader==0.4
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.9.2
mdurl==0.1.2
mpmath==1.3.0
networkx==3.3
nibabel==5.2.1
numpy==1.26.4
packaging==24.1
pandas==2.2.2
pillow==10.4.0
plotly==5.24.0
protobuf==5.28.0
psutil==6.0.0
Pygments==2.18.0
pyparsing==3.1.4
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.2
requests==2.32.3
rich==13.8.0
scikit-image==0.24.0
scikit-learn==1.5.1
scipy==1.14.1
shellingham==1.5.4
SimpleITK==2.4.0
six==1.16.0
sympy==1.13.2
tenacity==9.0.0
tensorboard==2.17.1
tensorboard-data-server==0.7.2
threadpoolctl==3.5.0
tifffile==2024.8.30
torch==2.4.1
torchio==0.19.9
torchvision==0.19.1
tqdm==4.66.5
typer==0.12.5
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.2
Werkzeug==3.0.4
wrapt==1.16.0
yacs==0.1.8

Execution

python3.10 FastSurfer/FastSurferCNN/run_prediction.py --t1 /....../T1_input.nii.gz --asegdkt_segfile /...../aparc+aseg.orig.nii.gz --conformed_name /...../T1_conform.nii.gz --brainmask_name /...../mask.nii.gz --aseg_name /...../aseg.auto_noCCseg.nii.gz --sid OAS1_0111_MR2_l --seg_log /dev/null --vox_size min --batch_size 1 --viewagg_device auto --device mps

This issue might be a nibabel bug.

The header gets initialized here and these specific fields never get touched after.

Also, these MR infos are kind of specific to MGH format and not usually included in other file formats such as nifti.