From baghdadi at phenogenomics.ca Fri Jun 3 12:00:51 2011 From: baghdadi at phenogenomics.ca (Leila Baghdadi) Date: Fri, 3 Jun 2011 12:00:51 -0400 Subject: [MINC-development] MINC and ITK Message-ID: <31542124.15751307116851002.JavaMail.root@mail2.phenogenomics.ca> Hi everyone, Just thought of sending an update to the minc community regarding support for MINC in ITK. My code (ITKMINC2IO) (originally written in 2008 and not maintained, blame it on maternity leave(s)!), can only support MINC2 files and right now requires work as various things have changed in ITK since then, I am in the process of rewriting some parts of the above, and will resubmit a new version to the ITK-journal once I have it completed! (I do want to resubmit this code as it makes exclusive minc2 api calls ) meanwhile, The code of Vladimir (EZminc), can read both formats and is much more up-to-date, Please send me any questions or concerns Leila ----- Original Message ----- From: Andrew Janke Sent: Sun, 5/15/2011 8:29pm To: MINC development discussion & planning Subject: Re: [MINC-development] MINC and ITK > That's my understanding as well - we (us Toronto folks, that is), seem to be the happiest in the MINC community to discard MINC1 compatibility, Pick me too! I have been MINC2 only for at least the last 3 years, the impending MINC2.2 release will finally drive the final nail in the MINC1 coffin. The default will be to write out MINC2 files irrespective of what the input was. I don't plan to add a -1 flag to all the binaries to write out MINC1 and instead will only add a -1 flag to mincconvert for the sticklers. For those asking why, I have had requests for this from users none of whom were from the BIC! Perhaps I should open a separate thread about this on minc-dev but expect to see my commits for this on github shortly. a _______________________________________________ MINC-development mailing list MINC-development at bic.mni.mcgill.ca http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development From matthijs at phenogenomics.ca Tue Jun 14 12:12:57 2011 From: matthijs at phenogenomics.ca (Matthijs van Eede) Date: Tue, 14 Jun 2011 12:12:57 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask Message-ID: <4DF78889.8070702@phenogenomics.ca> Greetings, I have recently installed N3-1.12 together with ebtks 1.6.4, and I am getting different results when I run a non uniformity correction with a mask as compared to N3-1.11. In 1.12 the image intensities outside of the mask are "blown up"; they are about an order of magnitude brighter than the voxels within the mask. Are there changes between the two versions that can cause this? Thanks in advance, Matthijs From claude at bic.mni.mcgill.ca Tue Jun 14 12:30:57 2011 From: claude at bic.mni.mcgill.ca (Claude LEPAGE) Date: Tue, 14 Jun 2011 12:30:57 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask In-Reply-To: <4DF78889.8070702@phenogenomics.ca> Message-ID: <201106141630.p5EGUvwW013412@cassio.bic.mni.mcgill.ca> Hi Matthijs, > I have recently installed N3-1.12 together with ebtks 1.6.4, and I am > getting different results when I run a non uniformity correction with a > mask as compared to N3-1.11. In 1.12 the image intensities outside of > the mask are "blown up"; they are about an order of magnitude brighter > than the voxels within the mask. Are there changes between the two > versions that can cause this? > > Thanks in advance, > Matthijs At first sight, this is unexpected. Does this happen on all subjects or only on one of them? How large is your field of view outside the mask? Does the mask touch the borders of the field of view? Is this a regular t1 image? If not, what type of scan is it? In 1.12, I improved the convergence of the field outside the mask when voxels are not 1mm. The number of iterations was tuned for 1mm voxels, so 1.12 did not converge fully on much smaller voxel sizes and was much slower (I'm working with histology data at 10 microns). What command did you use? You can try with slightly more damping (default -lambda 1.0e-7 so try 1.0e-6). If you can send me a typical scan, you can dump it in: http://www.bic.mni.mcgill.ca/cgi-bin/BICupload Provide the original scan, its mask, and the outputs you obtained with 1.11 and 1.12, together with instructions on how to reproduce the problem. Yours, Claude From matthijs at phenogenomics.ca Tue Jun 14 16:11:44 2011 From: matthijs at phenogenomics.ca (Matthijs van Eede) Date: Tue, 14 Jun 2011 16:11:44 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask In-Reply-To: <201106141630.p5EGUvwW013412@cassio.bic.mni.mcgill.ca> References: <201106141630.p5EGUvwW013412@cassio.bic.mni.mcgill.ca> Message-ID: <4DF7C080.10904@phenogenomics.ca> Hi Claude, On 11-06-14 12:30 PM, Claude LEPAGE wrote: > Hi Matthijs, > >> I have recently installed N3-1.12 together with ebtks 1.6.4, and I am >> getting different results when I run a non uniformity correction with a >> mask as compared to N3-1.11. In 1.12 the image intensities outside of >> the mask are "blown up"; they are about an order of magnitude brighter >> than the voxels within the mask. Are there changes between the two >> versions that can cause this? >> >> Thanks in advance, >> Matthijs > At first sight, this is unexpected. Does this happen on all subjects > or only on one of them? How large is your field of view outside the > mask? Does the mask touch the borders of the field of view? Is this > a regular t1 image? If not, what type of scan is it? > It happens in about 40% of the cases (about 20 files so far). The masks cover around 45% of the volume. I checked one of the files where this happens, the mask touches one of the borders of the volume. (Maybe interesting to note, is that in that area around the mask at that border, the output file is very bright) The files are t2 weighted. The resolution for these files are: image: unsigned short 0 to 65535 image dimensions: zspace yspace xspace dimension name length step start -------------- ------ ---- ----- zspace 152 0.056 -4.2 yspace 294 0.056 -8.19 xspace 225 0.056 -6.27 > In 1.12, I improved the convergence of the field outside the mask when > voxels are not 1mm. The number of iterations was tuned for 1mm voxels, > so 1.12 did not converge fully on much smaller voxel sizes and was > much slower (I'm working with histology data at 10 microns). > > What command did you use? You can try with slightly more damping > (default -lambda 1.0e-7 so try 1.0e-6). The commands I used are: nu_estimate -distance 8 -iterations 100 -stop 0.0001 -fwhm 0.15 -shrink 4 -mask mask.mnc input.mnc output.imp and nu_evaluate -mapping output.imp input.mnc input_nu_evaluated.mnc Using -lambda 1.0e-6 made it a lot better. It almost fixed it, but you can still see a slight "halo" on the outside of the corrected brain. I have uploaded the input and output files to McGill, and actually saw that the other version of N3 I was using was 1.10, not 1.11. Thanks very much! Matthijs > If you can send me a typical scan, you can dump it in: > http://www.bic.mni.mcgill.ca/cgi-bin/BICupload > Provide the original scan, its mask, and the outputs you obtained with > 1.11 and 1.12, together with instructions on how to reproduce the > problem. > > Yours, > > Claude > _______________________________________________ > MINC-development mailing list > MINC-development at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development From claude at bic.mni.mcgill.ca Tue Jun 14 18:25:20 2011 From: claude at bic.mni.mcgill.ca (Claude LEPAGE) Date: Tue, 14 Jun 2011 18:25:20 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask In-Reply-To: <4DF78889.8070702@phenogenomics.ca> Message-ID: <201106142225.p5EMPKSG020094@cassio.bic.mni.mcgill.ca> Hi Matthijs, I looked at the scan. This is a mouse. :-) The mask you sent me covers the entire head. You would get better results with a tighter mask that includes only the brain, since there are lots of hyperintense voxels in the tissues surrounding the brain. These can affect the splines in N3. The old N3-1.10, which you used, had a major bug in it in terms of damping. For a masked human brain in stereotaxic space at 1mm, the damping was equivalent to about 3e-05 at a shrink factor of 4. (Note that the old N3 was still good at those settings, so don't panic about your old results.) This effective damping was normalized by the number of sampling points in the mask in one hard-coded coefficient. For a mouse with different voxel sizes, total brain size, shrink factor, you need to be careful about the meaning of damping in the old vs new N3. In the newer version, the formulation is now invariant to sampling resolution and damping means damping. For example, resampling at 0.5mm or 1.0mm will now give the same answer. This is why you observed quite different results with 1.10 and 1.12. The instabilities in 1.11 or 1.12 were due to a too small damping coefficient and likely also a too generous mask. You can also try to add a bit of padding around the current field of view (use autocrop -isoexpand). You should talk to Jason Lerch, also at Phenogenomics, for suitable parameters for N3 (spline distance, for example). 8mm might be too large a value for a mouse brain. Good luck, Claude > >> I have recently installed N3-1.12 together with ebtks 1.6.4, and I am > >> getting different results when I run a non uniformity correction with a > >> mask as compared to N3-1.11. In 1.12 the image intensities outside of > >> the mask are "blown up"; they are about an order of magnitude brighter > >> than the voxels within the mask. Are there changes between the two > >> versions that can cause this? > >> > >> Thanks in advance, > >> Matthijs > > At first sight, this is unexpected. Does this happen on all subjects > > or only on one of them? How large is your field of view outside the > > mask? Does the mask touch the borders of the field of view? Is this > > a regular t1 image? If not, what type of scan is it? > > > It happens in about 40% of the cases (about 20 files so far). The masks > cover around 45% of the volume. I checked one of the files where this > happens, the mask touches one of the borders of the volume. (Maybe > interesting to note, is that in that area around the mask at that > border, the output file is very bright) The files are t2 weighted. The > resolution for these files are: > > image: unsigned short 0 to 65535 > image dimensions: zspace yspace xspace > dimension name length step start > -------------- ------ ---- ----- > zspace 152 0.056 -4.2 > yspace 294 0.056 -8.19 > xspace 225 0.056 -6.27 > > > > In 1.12, I improved the convergence of the field outside the mask when > > voxels are not 1mm. The number of iterations was tuned for 1mm voxels, > > so 1.12 did not converge fully on much smaller voxel sizes and was > > much slower (I'm working with histology data at 10 microns). > > > > What command did you use? You can try with slightly more damping > > (default -lambda 1.0e-7 so try 1.0e-6). > > The commands I used are: > > nu_estimate -distance 8 -iterations 100 -stop 0.0001 -fwhm 0.15 -shrink > 4 -mask mask.mnc input.mnc output.imp > > and > > nu_evaluate -mapping output.imp input.mnc input_nu_evaluated.mnc > > Using -lambda 1.0e-6 made it a lot better. It almost fixed it, but you > can still see a slight "halo" on the outside of the corrected brain. I > have uploaded the input and output files to McGill, and actually saw > that the other version of N3 I was using was 1.10, not 1.11. > > Thanks very much! > Matthijs > > > If you can send me a typical scan, you can dump it in: > > http://www.bic.mni.mcgill.ca/cgi-bin/BICupload > > Provide the original scan, its mask, and the outputs you obtained with > > 1.11 and 1.12, together with instructions on how to reproduce the > > problem. > > > > Yours, > > > > Claude > > _______________________________________________ > > MINC-development mailing list > > MINC-development at bic.mni.mcgill.ca > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development > From matthijs at phenogenomics.ca Tue Jun 14 23:32:57 2011 From: matthijs at phenogenomics.ca (Matthijs van Eede) Date: Tue, 14 Jun 2011 23:32:57 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask In-Reply-To: <201106142225.p5EMPKSG020094@cassio.bic.mni.mcgill.ca> References: <201106142225.p5EMPKSG020094@cassio.bic.mni.mcgill.ca> Message-ID: <8E37B06B-B395-49DC-BEAC-C5D8524F959B@phenogenomics.ca> Hi Claude, On 2011-06-14, at 6:25 PM, Claude LEPAGE wrote: > Hi Matthijs, > > I looked at the scan. This is a mouse. :-) > Yes :-) I don't work with anything else! > The mask you sent me covers the entire head. You would get better > results with a tighter mask that includes only the brain, since there > are lots of hyperintense voxels in the tissues surrounding the > brain. These can affect the splines in N3. I had no idea, thank you. > > The old N3-1.10, which you used, had a major bug in it in terms of > damping. For a masked human brain in stereotaxic space at 1mm, the > damping was equivalent to about 3e-05 at a shrink factor of 4. (Note > that the old N3 was still good at those settings, so don't panic > about your old results.) This effective damping was normalized by > the number of sampling points in the mask in one hard-coded > coefficient. For a mouse with different voxel sizes, total brain size, > shrink factor, you need to be careful about the meaning of damping in > the old vs new N3. In the newer version, the formulation is now invariant > to sampling resolution and damping means damping. For example, resampling > at 0.5mm or 1.0mm will now give the same answer. > Good to know that the old results are still okay. I'll sit down with Jason and John, so they can tell me a bit more about damping and to figure out what settings are appropriate for mouse brains. Thanks very much! Matthijs > This is why you observed quite different results with 1.10 and 1.12. > > The instabilities in 1.11 or 1.12 were due to a too small damping > coefficient and likely also a too generous mask. You can also try > to add a bit of padding around the current field of view (use > autocrop -isoexpand). > > You should talk to Jason Lerch, also at Phenogenomics, for suitable > parameters for N3 (spline distance, for example). 8mm might be too > large a value for a mouse brain. > > Good luck, > > Claude > >>>> I have recently installed N3-1.12 together with ebtks 1.6.4, and I am >>>> getting different results when I run a non uniformity correction with a >>>> mask as compared to N3-1.11. In 1.12 the image intensities outside of >>>> the mask are "blown up"; they are about an order of magnitude brighter >>>> than the voxels within the mask. Are there changes between the two >>>> versions that can cause this? >>>> >>>> Thanks in advance, >>>> Matthijs >>> At first sight, this is unexpected. Does this happen on all subjects >>> or only on one of them? How large is your field of view outside the >>> mask? Does the mask touch the borders of the field of view? Is this >>> a regular t1 image? If not, what type of scan is it? >>> >> It happens in about 40% of the cases (about 20 files so far). The masks >> cover around 45% of the volume. I checked one of the files where this >> happens, the mask touches one of the borders of the volume. (Maybe >> interesting to note, is that in that area around the mask at that >> border, the output file is very bright) The files are t2 weighted. The >> resolution for these files are: >> >> image: unsigned short 0 to 65535 >> image dimensions: zspace yspace xspace >> dimension name length step start >> -------------- ------ ---- ----- >> zspace 152 0.056 -4.2 >> yspace 294 0.056 -8.19 >> xspace 225 0.056 -6.27 >> >> >>> In 1.12, I improved the convergence of the field outside the mask when >>> voxels are not 1mm. The number of iterations was tuned for 1mm voxels, >>> so 1.12 did not converge fully on much smaller voxel sizes and was >>> much slower (I'm working with histology data at 10 microns). >>> >>> What command did you use? You can try with slightly more damping >>> (default -lambda 1.0e-7 so try 1.0e-6). >> >> The commands I used are: >> >> nu_estimate -distance 8 -iterations 100 -stop 0.0001 -fwhm 0.15 -shrink >> 4 -mask mask.mnc input.mnc output.imp >> >> and >> >> nu_evaluate -mapping output.imp input.mnc input_nu_evaluated.mnc >> >> Using -lambda 1.0e-6 made it a lot better. It almost fixed it, but you >> can still see a slight "halo" on the outside of the corrected brain. I >> have uploaded the input and output files to McGill, and actually saw >> that the other version of N3 I was using was 1.10, not 1.11. >> >> Thanks very much! >> Matthijs >> >>> If you can send me a typical scan, you can dump it in: >>> http://www.bic.mni.mcgill.ca/cgi-bin/BICupload >>> Provide the original scan, its mask, and the outputs you obtained with >>> 1.11 and 1.12, together with instructions on how to reproduce the >>> problem. >>> >>> Yours, >>> >>> Claude >>> _______________________________________________ >>> MINC-development mailing list >>> MINC-development at bic.mni.mcgill.ca >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development >> > _______________________________________________ > MINC-development mailing list > MINC-development at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development From matthijs at phenogenomics.ca Wed Jun 15 10:08:21 2011 From: matthijs at phenogenomics.ca (Matthijs van Eede) Date: Wed, 15 Jun 2011 10:08:21 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask In-Reply-To: <8E37B06B-B395-49DC-BEAC-C5D8524F959B@phenogenomics.ca> References: <201106142225.p5EMPKSG020094@cassio.bic.mni.mcgill.ca> Message-ID: <4DF8BCD5.2030600@phenogenomics.ca> Hi Claude, I have a follow-up question related to the lambda value. Do you know the formula that we can use to compute the lambda value for the current version of N3 which will give the same result as using 1.0e-7 in N3 1.10 given the other settings? Thanks, Matthijs On 11-06-14 11:32 PM, Matthijs van Eede wrote: > Hi Claude, > > > On 2011-06-14, at 6:25 PM, Claude LEPAGE wrote: > >> Hi Matthijs, >> >> I looked at the scan. This is a mouse. :-) >> > Yes :-) I don't work with anything else! > >> The mask you sent me covers the entire head. You would get better >> results with a tighter mask that includes only the brain, since there >> are lots of hyperintense voxels in the tissues surrounding the >> brain. These can affect the splines in N3. > I had no idea, thank you. > >> The old N3-1.10, which you used, had a major bug in it in terms of >> damping. For a masked human brain in stereotaxic space at 1mm, the >> damping was equivalent to about 3e-05 at a shrink factor of 4. (Note >> that the old N3 was still good at those settings, so don't panic >> about your old results.) This effective damping was normalized by >> the number of sampling points in the mask in one hard-coded >> coefficient. For a mouse with different voxel sizes, total brain size, >> shrink factor, you need to be careful about the meaning of damping in >> the old vs new N3. In the newer version, the formulation is now invariant >> to sampling resolution and damping means damping. For example, resampling >> at 0.5mm or 1.0mm will now give the same answer. >> > Good to know that the old results are still okay. I'll sit down with Jason and John, so they can tell me a bit more about damping and to figure out what settings are appropriate for mouse brains. > > Thanks very much! > Matthijs > >> This is why you observed quite different results with 1.10 and 1.12. >> >> The instabilities in 1.11 or 1.12 were due to a too small damping >> coefficient and likely also a too generous mask. You can also try >> to add a bit of padding around the current field of view (use >> autocrop -isoexpand). >> >> You should talk to Jason Lerch, also at Phenogenomics, for suitable >> parameters for N3 (spline distance, for example). 8mm might be too >> large a value for a mouse brain. >> >> Good luck, >> >> Claude >> >>>>> I have recently installed N3-1.12 together with ebtks 1.6.4, and I am >>>>> getting different results when I run a non uniformity correction with a >>>>> mask as compared to N3-1.11. In 1.12 the image intensities outside of >>>>> the mask are "blown up"; they are about an order of magnitude brighter >>>>> than the voxels within the mask. Are there changes between the two >>>>> versions that can cause this? >>>>> >>>>> Thanks in advance, >>>>> Matthijs >>>> At first sight, this is unexpected. Does this happen on all subjects >>>> or only on one of them? How large is your field of view outside the >>>> mask? Does the mask touch the borders of the field of view? Is this >>>> a regular t1 image? If not, what type of scan is it? >>>> >>> It happens in about 40% of the cases (about 20 files so far). The masks >>> cover around 45% of the volume. I checked one of the files where this >>> happens, the mask touches one of the borders of the volume. (Maybe >>> interesting to note, is that in that area around the mask at that >>> border, the output file is very bright) The files are t2 weighted. The >>> resolution for these files are: >>> >>> image: unsigned short 0 to 65535 >>> image dimensions: zspace yspace xspace >>> dimension name length step start >>> -------------- ------ ---- ----- >>> zspace 152 0.056 -4.2 >>> yspace 294 0.056 -8.19 >>> xspace 225 0.056 -6.27 >>> >>> >>>> In 1.12, I improved the convergence of the field outside the mask when >>>> voxels are not 1mm. The number of iterations was tuned for 1mm voxels, >>>> so 1.12 did not converge fully on much smaller voxel sizes and was >>>> much slower (I'm working with histology data at 10 microns). >>>> >>>> What command did you use? You can try with slightly more damping >>>> (default -lambda 1.0e-7 so try 1.0e-6). >>> The commands I used are: >>> >>> nu_estimate -distance 8 -iterations 100 -stop 0.0001 -fwhm 0.15 -shrink >>> 4 -mask mask.mnc input.mnc output.imp >>> >>> and >>> >>> nu_evaluate -mapping output.imp input.mnc input_nu_evaluated.mnc >>> >>> Using -lambda 1.0e-6 made it a lot better. It almost fixed it, but you >>> can still see a slight "halo" on the outside of the corrected brain. I >>> have uploaded the input and output files to McGill, and actually saw >>> that the other version of N3 I was using was 1.10, not 1.11. >>> >>> Thanks very much! >>> Matthijs >>> >>>> If you can send me a typical scan, you can dump it in: >>>> http://www.bic.mni.mcgill.ca/cgi-bin/BICupload >>>> Provide the original scan, its mask, and the outputs you obtained with >>>> 1.11 and 1.12, together with instructions on how to reproduce the >>>> problem. >>>> >>>> Yours, >>>> >>>> Claude >>>> _______________________________________________ >>>> MINC-development mailing list >>>> MINC-development at bic.mni.mcgill.ca >>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development >> _______________________________________________ >> MINC-development mailing list >> MINC-development at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development > _______________________________________________ > MINC-development mailing list > MINC-development at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development From claude at bic.mni.mcgill.ca Wed Jun 15 12:14:18 2011 From: claude at bic.mni.mcgill.ca (Claude LEPAGE) Date: Wed, 15 Jun 2011 12:14:18 -0400 Subject: [MINC-development] N3-1.12 changed behaviour using a mask In-Reply-To: <4DF8BCD5.2030600@phenogenomics.ca> Message-ID: <201106151614.p5FGEIXw009851@cassio.bic.mni.mcgill.ca> Hi, N3-1.10 had an effective damping of about 3.5e-05 at 1mm voxel for a masked human brain in MNI space. 1.0e-7 might be a little small as the suggested default value in N3-1.11 and 1.12. I don't remember exactly the details leading to my estimation of the damping in the old code. What you can do is run N3 at different values of damping and plot the correction field (you can extract it if you look at the options in nu_correct). If damping is too small, you will get numerical instabilities (ill-conditioned matrix to invert). Claude > Hi Claude, > > I have a follow-up question related to the lambda value. Do you know the > formula that we can use to compute the lambda value for the current > version of N3 which will give the same result as using 1.0e-7 in N3 1.10 > given the other settings? > > Thanks, > Matthijs