Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem running inference on new data #44

Open
jcohenadad opened this issue Jan 24, 2024 · 1 comment
Open

Problem running inference on new data #44

jcohenadad opened this issue Jan 24, 2024 · 1 comment
Assignees

Comments

@jcohenadad
Copy link
Member

jcohenadad commented Jan 24, 2024

Problem

According to private discussions between @plbenveniste and Benjamin, running the code version https://github.com/ivadomed/model_seg_mouse-sc_wm-gm_t1/releases/tag/v0.3 on new data produced the following error:

image

The cause of the issue, identified by @plbenveniste, is that the input data have a corrupted NIfTI header. More specifically, the physical dimensions of the voxels are wrong, which cause memory saturation during resampling as part of the nnUnet preprocessing pipeline.

Solution

A solution is to make sure the data are correct. To do so:

  • in the first place, the data coming from the scanner should be converted to NIfTI using proper software. Dcm2niix is an example of a good software.
  • Alternatively (although the previous solution is best), the NIfTI headers could be manually corrected:
@plbenveniste plbenveniste self-assigned this Jan 24, 2024
@plbenveniste
Copy link
Collaborator

plbenveniste commented Jan 24, 2024

To solve this problem, I added the file correct_file_header.py in utils which corrects the Nifti header.
This script updates the xdim, ydim, zdim and sets the sform matrix equal to the qform matrix.
The resolution has to be given in mm.

To use this file, run the following command (in the virtual environment):
python utils/correct_file_header.py --path-image /path/to/image --path-out /path/to/output/folder --resolution XX YY ZZ

For example, for 0.05 mm isotropic:
python utils/correct_file_header.py --path-image image.nii --path-out ~/Folder --resolution 0.05 0.05 0.05

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

No branches or pull requests

2 participants