Hi Barbara,
Hang on, this will be slightly hairy.
Right now, if you're not using the -3T flag when you run recon-all, you're essentially invoking N3 four times (the N3 wrapper, mri_nu_correct.mni). Every time you invoke N3, the output files are stored in separate directories (the once you located yourself). If you use the -3T flag, things simplifies greatly.
I presume you're not using the -3T flag, since you mentioned several N3 output directories.
Now generally, in terms of the bias field correction model (bias is assumed to be multiplicative), there's no difference in running N3 once or four times. However, N3 does a couple of things that will yield a small difference. N3 first computes a threshold mask, which it uses to limit the voxels it estimates the bias from. Then it estimates the bias. Then it performs a final smoothing of the bias, and then it divides the uncorrected data with the bias to obtain a corrected estimate.
So to summarize, when you do not use the -3T parameter, you:
1. threshold a mask 2. estimate a bias 3. do a final smoothing of the bias 4. correct (divide uncorrected with bias) 5. repeat from 1.
The effect of the above might or might not be negligible, depending on your data. Practically though, the big chunk of the correction is done in the first mri_nu_correct.mni iteration. And if you're using -3T, you can disregard step 5.
What kind of data do you work on (field strength)?
To answer your question: If you want the 'bias' that is corrected for with Freesurfer, you want to divide the volume prior to feeding mri_nu_correct.mni, with the corrected volume after running mri_nu_correct.mni the fourth time. You could also try to run nu_correct yourself with the proper arguments - this gives you a much better understanding of the method - and internal output that you can log and analyse (-verbose flag).
If you need to work with the tmp files, The thresholded mask you're interested in, is called nuc_auto_mask.mnc. The field estimate that N3 uses to divide the uncorrected data, is called corrected_field.mnc. Note that I'm working directly with the N3 binary, so there's a chance that the names differ (but I do not think so, since these names seem to be hardcoded).
There should not be any differences in volume dimensions, if you're using the right volumes.
Best, Christian
On 08/29/2014 10:34 AM, Barbara Kreilkamp wrote:
Dear Freesurfers,
The recon-all.log does not give info about the intermediate outputs (like nu2_est and nu2_field mnc-files), could you please confirm that the nu2_field.mnc is the bias field volume? It is the biggest file of all and is one of the last files generated by the script, but I would like to be sure.
Thank you very much, Barbara
On Thu, Aug 28, 2014 at 3:27 PM, Barbara Kreilkamp <bakk.hbg@googlemail.com mailto:bakk.hbg@googlemail.com> wrote:
Dear Bruce and Christian, I found the easy way of simply writing 'set cleanup = 0' at the beginning of mri_nu_correct.mni and then I run this command mri_nu_correct.mni --i T2-scic/mri/orig/001.mgz --o nu.mgz --n 2 This way I get all the masks and iterations that were computed. Now I also see that it generates as many folders as there are iterations, ending with nu2_field and nu2_est if there are two iterations. I see more files now and now I am thinking that the last output is nu2_field, which would be the bias field. So this is why I did not divide anything by hand (also because my 001.mgz and the nu.mgz do not have the same image dimensions) and the info about masked-out voxel would be missing in that case. All the best and thanks. Barbara On 28/08/2014 14:46, Bruce Fischl wrote: Hi Barbara what exactly did you divide? If you look at the recon-all.log it will show the exact inputs and outputs of nu_correct. cheers Bruce On Thu, 28 Aug 2014, Barbara Kreilkamp wrote: Dear Christian, Thanks a bunch for this answer. I ran all the steps you mentioned (except for the one where I simply do uncorrected/corrected, as these images have different dimensions, it seems nu3 does more than just normalization of intensities, but also image cropping). Do you know anything about the image cropping? I ended up with the output nu1_mask and nu1_est and I think the last one is the bias field, at least it looks very much like one :). Am I right? Thanks for your help, Barbara On 27/08/2014 22:53, Christian Thode Larsen wrote: Hi Barbara, I'm not aware of any way that you can do it directly by passing arguments to recon-all (some might correct me on that), but it is possible: 1) As N3 models the bias as a multiplicative effect uncorrected = corrected * bias, the simplest way is to divide each voxel of the volume before and after correction, in order to obtain a volume containing the bias. Note that N3 (by default) works within a mask where low-intensity voxels have been thresholded away. These voxels will contain garbage if you divide all voxels in the volume. 2) Somewhat more complicated: you can specify the -keeptmp flag combined with -tmp SOMEDIR/ (remember the trailing slash) to N3, in order to preserve its working files. This requires you to modify the N3 binary call in the mri_nu_correct.mni script. You also need to convert the mnc files from the tmp dir, so that you can work with the volumes. 3) if you do 2), you also get hold of the low-intensity voxel mask that N3 operates within. You can use this to constrain the division mentioned in 1). Best, Christian On 8/27/2014 11:18 PM, Barbara Kreilkamp wrote: Dear all, Is there a way to output the N3's (non-parametric normalization step) output? I am interested in the bias field that was computed to correct the image intensities. Thank you for your help, Barbara _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu <mailto:Freesurfer@nmr.mgh.harvard.edu> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.