[MINC-users] Nu_correct error: mask volume and input volume different in size

Claude LEPAGE claude at bic.mni.mcgill.ca
Mon Sep 14 10:27:30 EDT 2020


Hi,

By same size, we mean the dimensions of the volume, not the file
size on disk. Same number of voxels in x, y, z directions. You can
use the command mincinfo on the volume and the mask.

% mincinfo t1_final.mnc 

file: t1_final.mnc
image: signed__ float 0 to 70760.0625
image dimensions: zspace yspace xspace
    dimension name         length         step        start
    --------------         ------         ----        -----
    zspace                    255         0.25       -26.75
    yspace                    430         0.25        -61.5
    xspace                    421         0.25        -52.5

The mask needs to be the same size with the same dimension order
(here z, y, x).

Use mincresample to resample the mask like the input volume.

mincresample -clobber -like t1_image.mnc -nearest input_mask.mnc output_mask.mnc

Note: -nearest is to have a binary mask 0,1.

It would be interesting to know which version of N3 FreeSurfer is still
using. Last I heard, it was an ancient version based on minc-1 format
(uncompressed). But FreeSurfer does work without crashing at this stage, 
so maybe it's a problem introduced in your modified version.

Claude


>
> Hello,
>
> I was wondering if someone can help me understand the issue I am running
> into with nu_correct.
>
> During the nu_correct stage while preprocessing MRI images through a
> modified version of FreeSurfer and I ran into this error:
>
> Iteration 1 2020. 09. 08. (화) 22:45:28 KST
> nu_correct -clobber
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/nu0.mnc
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/nu1.mnc
> -tmpdir
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/0/
> -iterations 1000 -distance 50 -mask
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/mask.mnc
> [shinhm91 at metamind-H270:/home/shinhm91/fastsurfer_analysis/005_S_0602/mri/]
> [2020-09-08 22:45:28] running:
>   /usr/local/freesurfer/mni/bin/nu_estimate_np_and_em -parzen -log -sharpen
> 0.15 0.01 -iterations 1000 -stop 0.001 -shrink 4 -auto_mask -nonotify
> -b_spline 1.0e-7 -distance 50 -mask
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/mask.mnc
> -quiet -execute -clobber -nokeeptmp -tmpdir
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/0/
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/nu0.mnc
> /home/shinhm91/fastsurfer_analysis/005_S_0602/mri/tmp.mri_nu_correct.mni.9950/nu1.imp
>
> Transforming
> slices:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Processing:.................................................................Done
> Number of iterations: 56
> CV of field change: 0.000980823
> 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
> Command exited with non-zero status 1
> @#@FSTIME  2020:09:08:22:45:23 mri_nu_correct.mni N 13 e 24.51 S 1.99 U
> 22.21 P 98% M 158792 F 108 R 587187 W 0 c 1830 w 5685 I 35488 O 1185720 L
> 3.65 2.13 1.79
> @#@FSLOADPOST 2020:09:08:22:45:48 mri_nu_correct.mni N 13 3.24 2.15 1.81
>
> So I was able to find from MINC wikibooks page (
> https://en.wikibooks.org/wiki/MINC/Tools/N3) about possibly fixing this
> issue with specified mask volume by running the code: mincmath -gt -const 0
> mask.mnc new_mask.mnc but that still didn't solve the problem.
>
> I tried checking file sizes for mask.mnc and nu0.mnc and the funny thing is
> before running nu_correct both mask.mnc and nu0.mnc files are indeed same
> in size:
>
> 211M . <---- parent directory size
> 65M ./nu0.mnc
> 65M ./new_mask.mnc
> 65M ./mask.mnc
> 19M ./0
> 140K ./mask.mgz
> 20K ./nu1.imp
>
> but if you see the tmp file called 0 that is used to store files while
> running nu_correct, mask.mnc and nu0.mnc files are different in size:
>
> 8.5M . <---- ./0 temp directory for running nu_correct
> 1.1M ./nu1_temp.mnc
> 1.1M ./nu1_residue.mnc
> 1.1M ./nu1_log.mnc
> 1.1M ./nu1_est.mnc.temp
> 1.1M ./nu1_est.mnc
> 1.1M ./nu1_corr.mnc
> 1.1M ./nu0.mnc
> 544K ./nu1_mask.mnc
> 276K ./new_mask.mnc
> 276K ./mask.mnc
> 8.0K ./nu1_est.sharp
> 8.0K ./nu1_est.hist
>
> Does nu_correct re-process nu0.mnc and mask.mnc from original files? I just
> want to understand how I got different file sizes in tmp directory.
>
> Best,
> Julia Shin
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> https://mailman.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>


More information about the MINC-users mailing list