Deep-MI / FastSurfer

PyTorch implementation of FastSurferCNN
Apache License 2.0
459 stars 120 forks source link

Crash in nu_correct if FOV > 256 #45

Closed davecash75 closed 2 years ago

davecash75 commented 3 years ago

Hi there- I'm currently using the CPU Docker and I am running the standard docker command for the full FastSurfer as you have in the README, with the exception that I pass in a Nifti where the FOV is greater than 256 mm. WHen I run, the deep_seg runs fine but during the recon, I get a crash with the following key messages: WARNING ==================++++++++++++++++++++++++======================================= The physical sizes are (228.80 mm, 282.00 mm, 282.00 mm), which cannot fit in 256^3 mm^3 volume. The resulting volume will have 282 slices. If you find problems, please let us know (freesurfer@nmr.mgh.harvard.edu). ==================================================++++++++++++++++++++++++=============== Mask volume and input volume must be the same size. nu_evaluate: crashed while running evaluate_field (termination status=512) nu_correct: crashed while running nu_evaluate (termination status=512) ERROR: nu_correct I run mri_convert with the --cw256 command outside of FastSurfer, and it no longer has this error. So I guess the question is would it be possible to have an option that conforms (and crops) images with FOV > 256 mm just like the original FreeSurfer allows. Many thanks, David Cash

m-reuter commented 3 years ago

Hi David, yes such a flag would make sense. Currently, with large field of view, you need to convert images yourself before you pass them into FastSurfer. If you end up modifying our scripts to take such a flag, please generate a pull request. Thanks

m-reuter commented 2 years ago

I have looked into this a little. conform.py seems to be able to automatically conform these to 255 cube images. This is however not written out. Instead recon_surf later uses mri_convert with the regular conform flag which does not conform to 256 and in turn which is why nu_correct fails later. There are several solutions to this, and probably the best is to write out the conformed image from the segmentation step and use it later. Care needs to be taken to a) have the recon_surf stream also work on other images and segmentations that do not come out of our FScnn, b) these steps have the additional purpose to convert inputs to mgz (e.g. from nifti). It may make sense to switch everything to nifti completely. Maybe together with a switch to a more modern Freesurfer version.

A quick fix for now would be to replace the mri_convert -c in recon surf to mri_convert --cw256 and by default always go to a 256 field of view.

m-reuter commented 2 years ago

should be fixed by #92