From redoute at cermep.fr Mon Jan 4 10:52:20 2016 From: redoute at cermep.fr (=?UTF-8?B?SsOpcsO0bWUgUmVkb3V0w6k=?=) Date: Mon, 4 Jan 2016 16:52:20 +0100 Subject: [MINC-users] Multi-frames viewing Message-ID: <568A9534.8020906@cermep.fr> Hi, Is there a visualisation tool allowing to display multi-frames minc files? Register only access to the first frame... Thanks for your help and happy new year Jerome -- ================================================================== J?r?me Redout? Ph.D. - Ing?nieur de Recherche - Universit? Claude Bernard - Lyon1 CERMEP - Imagerie du vivant 59 Bd Pinel. 69677 Bron - FRANCE tel : 33 (0)4 72 68 86 18 (bureau) tel : 33 (0)4 72 68 86 00 (standard) fax : 33 (0)4 72 68 86 10 ================================================================== From robert.d.vincent at mcgill.ca Mon Jan 4 11:18:37 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Mon, 4 Jan 2016 11:18:37 -0500 Subject: [MINC-users] Multi-frames viewing In-Reply-To: <568A9534.8020906@cermep.fr> References: <568A9534.8020906@cermep.fr> Message-ID: Hi, In fact, register does support multi-frame viewing, at least it has for several years. You should be able to use the '>' and '<' keys to move forwards or backwards along the time dimensions. You should also see an editable field with the label "T:" that gives the current time and allows you to enter the desired time coordinate. MNI-Display now also supports multi-frame data, but that is only in the newest versions. -bert On Mon, Jan 4, 2016 at 10:52 AM, J?r?me Redout? wrote: > Hi, > Is there a visualisation tool allowing to display multi-frames minc files? > Register only access to the first frame... > Thanks for your help and happy new year > Jerome > > -- > ================================================================== > J?r?me Redout? > Ph.D. - Ing?nieur de Recherche - Universit? Claude Bernard - Lyon1 > CERMEP - Imagerie du vivant > 59 Bd Pinel. 69677 Bron - FRANCE > tel : 33 (0)4 72 68 86 18 (bureau) > tel : 33 (0)4 72 68 86 00 (standard) > fax : 33 (0)4 72 68 86 10 > ================================================================== > > > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From a.janke at gmail.com Tue Jan 5 02:21:15 2016 From: a.janke at gmail.com (Andrew Janke) Date: Tue, 5 Jan 2016 17:21:15 +1000 Subject: [MINC-users] Merge of MINC interface into nipy Message-ID: Some may be interested in this: https://github.com/nipy/nipype/pull/1304 It's a pull request (now merged) to add the main minc tool interfaces to nipype. It was done based upon volgenmodel by Carlo Hamalainen (who used to work with me). a From robert.d.vincent at mcgill.ca Tue Jan 5 09:03:04 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Tue, 5 Jan 2016 09:03:04 -0500 Subject: [MINC-users] Merge of MINC interface into nipy In-Reply-To: References: Message-ID: That's great. One thing on my to-do list is to create some MINC enhancements for nibabel. -bert On Tue, Jan 5, 2016 at 2:21 AM, Andrew Janke wrote: > Some may be interested in this: > > https://github.com/nipy/nipype/pull/1304 > > It's a pull request (now merged) to add the main minc tool interfaces > to nipype. It was done based upon volgenmodel by Carlo Hamalainen (who > used to work with me). > > > a > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From zijdenbos at gmail.com Sun Jan 10 16:25:52 2016 From: zijdenbos at gmail.com (Alex Zijdenbos) Date: Sun, 10 Jan 2016 16:25:52 -0500 Subject: [MINC-users] Multi-modal image registration Message-ID: Hi all, I am looking for a way to perform multi-modal image registration - i.e., perform linear+non-linear alignment while optimizing a similarity metric simultaneously based on multiple input volumes. Two specific questions: 1) minctracc obviously doesn't do this. Is there any chance that anybody has, or is working on, generalizing minctracc to multi-modal data? 2) ANTs does support this, so that may be one avenue to pursue; has anybody perhaps 'translated' the more-or-less standard minctracc registration protocols (e.g., nlfit_s) to comparable ANTs invocations? Any suggestions would be appreciated. Thanks, -- A From francois.hebert007 at gmail.com Mon Jan 11 09:16:10 2016 From: francois.hebert007 at gmail.com (Francois Hebert) Date: Mon, 11 Jan 2016 09:16:10 -0500 Subject: [MINC-users] Multi-modal image registration In-Reply-To: References: Message-ID: Hi Alex, You may be interested by this tool: http://www.ncbi.nlm.nih.gov/pubmed/22722056 Regards, Francois 2016-01-10 16:25 GMT-05:00 Alex Zijdenbos : > Hi all, > > I am looking for a way to perform multi-modal image registration - i.e., > perform linear+non-linear alignment while optimizing a similarity metric > simultaneously based on multiple input volumes. Two specific questions: > > 1) minctracc obviously doesn't do this. Is there any chance that anybody > has, or is working on, generalizing minctracc to multi-modal data? > > 2) ANTs does support this, so that may be one avenue to pursue; has anybody > perhaps 'translated' the more-or-less standard minctracc registration > protocols (e.g., nlfit_s) to comparable ANTs invocations? > > Any suggestions would be appreciated. > > Thanks, > > -- A > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From vladimir.fonov at gmail.com Mon Jan 11 09:44:55 2016 From: vladimir.fonov at gmail.com (Vladimir S. FONOV) Date: Mon, 11 Jan 2016 09:44:55 -0500 Subject: [MINC-users] Multi-modal image registration In-Reply-To: References: Message-ID: Hello Alex, 1. mintracc can do it, it's even implemented in nlfit_s , see -sec_source -sec_target -sec_weight 2. see https://gist.github.com/vfonov/d03db8794181a69a9e66 - it's out of data, since it uses mincANTS, it will work if you replace mincANTS with just ANTS On Sun, Jan 10, 2016 at 4:25 PM, Alex Zijdenbos wrote: > Hi all, > > I am looking for a way to perform multi-modal image registration - i.e., > perform linear+non-linear alignment while optimizing a similarity metric > simultaneously based on multiple input volumes. Two specific questions: > > 1) minctracc obviously doesn't do this. Is there any chance that anybody > has, or is working on, generalizing minctracc to multi-modal data? > > 2) ANTs does support this, so that may be one avenue to pursue; has anybody > perhaps 'translated' the more-or-less standard minctracc registration > protocols (e.g., nlfit_s) to comparable ANTs invocations? > > Any suggestions would be appreciated. > > Thanks, > > -- A > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > -- Best regards, Vladimir S. Fonov ~ vladimir fonov gmail com From ptcougopinto at gmail.com Tue Jan 12 09:27:14 2016 From: ptcougopinto at gmail.com (Pedro Telles Cougo Pinto) Date: Tue, 12 Jan 2016 12:27:14 -0200 Subject: [MINC-users] register_resample Message-ID: <9320A90F-EF04-41C6-951E-C5B8936717E8@gmail.com> Hi I?m using register from the latest minc-toolkit package for Mac OSX (http://packages.bic.mni.mcgill.ca/minc-toolkit/MacOSX/). It looks like register_resample is not included in the package. Register is failing to resample images, with the following output on terminal: sh: register_resample: command not found (from miopen): Unable to open file ?t1_2talman.mnc' register_resample is nowhere in /opt/minc-itk4, where the package is built. I see register_resample is present in Ubuntu tar.gz files. Thanks Pedro T Cougo Pinto ptcougopinto at gmail.com From robert.d.vincent at mcgill.ca Tue Jan 12 09:47:33 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Tue, 12 Jan 2016 09:47:33 -0500 Subject: [MINC-users] register_resample In-Reply-To: <9320A90F-EF04-41C6-951E-C5B8936717E8@gmail.com> References: <9320A90F-EF04-41C6-951E-C5B8936717E8@gmail.com> Message-ID: Hi Pedro, Thank you, this looks like an oversight in our build process. I will fix it. -bert On Tue, Jan 12, 2016 at 9:27 AM, Pedro Telles Cougo Pinto < ptcougopinto at gmail.com> wrote: > Hi > > I?m using register from the latest minc-toolkit package for Mac OSX ( > http://packages.bic.mni.mcgill.ca/minc-toolkit/MacOSX/). It looks like > register_resample is not included in the package. Register is failing to > resample images, with the following output on terminal: > > sh: register_resample: command not found > (from miopen): Unable to open file ?t1_2talman.mnc' > > register_resample is nowhere in /opt/minc-itk4, where the package is > built. I see register_resample is present in Ubuntu tar.gz files. > > Thanks > > Pedro T Cougo Pinto > ptcougopinto at gmail.com > > > > > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From ptcougopinto at gmail.com Tue Jan 12 10:14:22 2016 From: ptcougopinto at gmail.com (Pedro Telles Cougo Pinto) Date: Tue, 12 Jan 2016 13:14:22 -0200 Subject: [MINC-users] register_resample In-Reply-To: References: <9320A90F-EF04-41C6-951E-C5B8936717E8@gmail.com> Message-ID: Thanks, Robert Actually, there are some other issues I stumbled upon with this build I think man pages are not there. ctime.pl is required (I don?t remember for which program, probably mritoself or bestlinreg) but it?s no longer part of Perl releases. I had to get it from here (https://github.com/dwimperl/perl-5.12.3.0/blob/master/perl/lib/ctime.pl). Pedro T Cougo Pinto ptcougopinto at gmail.com > On Jan 12, 2016, at 12:47, Robert D. Vincent wrote: > > Hi Pedro, > > Thank you, this looks like an oversight in our build process. I will fix it. > > -bert > > On Tue, Jan 12, 2016 at 9:27 AM, Pedro Telles Cougo Pinto < > ptcougopinto at gmail.com> wrote: > >> Hi >> >> I?m using register from the latest minc-toolkit package for Mac OSX ( >> http://packages.bic.mni.mcgill.ca/minc-toolkit/MacOSX/). It looks like >> register_resample is not included in the package. Register is failing to >> resample images, with the following output on terminal: >> >> sh: register_resample: command not found >> (from miopen): Unable to open file ?t1_2talman.mnc' >> >> register_resample is nowhere in /opt/minc-itk4, where the package is >> built. I see register_resample is present in Ubuntu tar.gz files. >> >> Thanks >> >> Pedro T Cougo Pinto >> ptcougopinto at gmail.com >> >> >> >> >> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >> > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users From andrew at biospective.com Thu Jan 14 15:18:15 2016 From: andrew at biospective.com (Andrew Wood) Date: Thu, 14 Jan 2016 15:18:15 -0500 Subject: [MINC-users] Issue with itk_convert_xfm Message-ID: Hi all, I came across a set of transforms generated by ANTs which I've been trying to convert and use on minc volumes. There seems to be a bug in one or more of the tools I'm using, where applying the transforms to nifti volumes does not give the same result as applying them to minc volumes. Likely culprits: - itk_convet_xfm - mnc2nii or nii2mnc - antsApplyTransforms - mincresample Somewhere along the way, several components of the transforms get inverted. Here is an example: $ make_phantom phantom.mnc $ param2xfm -translation 10 10 10 trans.xfm # Apply the xfm $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc out.mnc # Do the same transform in nifti space $ itk_convert_xfm trans.xfm trans.mat $ mnc2nii phantom.mnc phantom.nii $ antsApplyTransforms --input phantom.nii \ --transform trans.mat \ --output out.nii \ --reference-image phantom.nii # Open result in a minc+nifti-friendly viewer, or convert back to minc $ nii2mnc out.nii thru_nifti.mnc $ register out.mnc thru_nifti.mnc The result of this for me is that the z component of the transform was inverted, but the x and y components are OK. >From experimenting with various simple transforms, it seems that the following components are inverted: - z translation - z rotation - x,y,z scale - x shear Has anybody else noticed or dealt with this before? Thanks, Andrew From vladimir.fonov at gmail.com Thu Jan 14 16:39:13 2016 From: vladimir.fonov at gmail.com (Vladimir S. FONOV) Date: Thu, 14 Jan 2016 16:39:13 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: Message-ID: antsApplyTransforms is basically equivalent to mincresample -invert_transformation On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood wrote: > Hi all, > > I came across a set of transforms generated by ANTs which I've been trying > to convert and use on minc volumes. There seems to be a bug in one or more > of the tools I'm using, where applying the transforms to nifti volumes does > not give the same result as applying them to minc volumes. > > Likely culprits: > - itk_convet_xfm > - mnc2nii or nii2mnc > - antsApplyTransforms > - mincresample > > Somewhere along the way, several components of the transforms get inverted. > Here is an example: > > $ make_phantom phantom.mnc > $ param2xfm -translation 10 10 10 trans.xfm > > # Apply the xfm > $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc out.mnc > > # Do the same transform in nifti space > $ itk_convert_xfm trans.xfm trans.mat > $ mnc2nii phantom.mnc phantom.nii > $ antsApplyTransforms --input phantom.nii \ > --transform trans.mat \ > --output out.nii \ > --reference-image phantom.nii > > # Open result in a minc+nifti-friendly viewer, or convert back to minc > $ nii2mnc out.nii thru_nifti.mnc > $ register out.mnc thru_nifti.mnc > > The result of this for me is that the z component of the transform was > inverted, but the x and y components are OK. > > From experimenting with various simple transforms, it seems that the > following components are inverted: > - z translation > - z rotation > - x,y,z scale > - x shear > > Has anybody else noticed or dealt with this before? > > Thanks, > Andrew > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > -- Best regards, Vladimir S. Fonov ~ vladimir fonov gmail com From andrew at biospective.com Thu Jan 14 17:04:49 2016 From: andrew at biospective.com (Andrew Wood) Date: Thu, 14 Jan 2016 17:04:49 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: Message-ID: Hi Vlad, I think I didn't explain my issue correctly. Let me add -invert_transformation to my mincresample invocation and try again. Here are the commands that I think illustrates a problem: $ make_phantom phantom.mnc $ param2xfm -translation 10 10 10 trans.xfm # Apply the xfm $ mincresample -use_input_sampling -*invert_transformation* -transform trans.xfm phantom.mnc out.mnc # Do the same transform in nifti space $ itk_convert_xfm trans.xfm trans.mat $ mnc2nii phantom.mnc phantom.nii $ antsApplyTransforms --input phantom.nii \ --transform trans.mat \ --output out.nii \ --reference-image phantom.nii # Open result in a minc+nifti-friendly viewer, or convert back to minc $ nii2mnc out.nii thru_nifti.mnc $ register out.mnc thru_nifti.mnc As far as I can tell, out.mnc and thru_nifti.mnc should be identical, but they clearly are not. Best, Andrew On Thu, Jan 14, 2016 at 4:39 PM, Vladimir S. FONOV wrote: > antsApplyTransforms is basically equivalent to mincresample > -invert_transformation > > On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood > wrote: > > > Hi all, > > > > I came across a set of transforms generated by ANTs which I've been > trying > > to convert and use on minc volumes. There seems to be a bug in one or > more > > of the tools I'm using, where applying the transforms to nifti volumes > does > > not give the same result as applying them to minc volumes. > > > > Likely culprits: > > - itk_convet_xfm > > - mnc2nii or nii2mnc > > - antsApplyTransforms > > - mincresample > > > > Somewhere along the way, several components of the transforms get > inverted. > > Here is an example: > > > > $ make_phantom phantom.mnc > > $ param2xfm -translation 10 10 10 trans.xfm > > > > # Apply the xfm > > $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc > out.mnc > > > > # Do the same transform in nifti space > > $ itk_convert_xfm trans.xfm trans.mat > > $ mnc2nii phantom.mnc phantom.nii > > $ antsApplyTransforms --input phantom.nii \ > > --transform trans.mat \ > > --output out.nii \ > > --reference-image phantom.nii > > > > # Open result in a minc+nifti-friendly viewer, or convert back to minc > > $ nii2mnc out.nii thru_nifti.mnc > > $ register out.mnc thru_nifti.mnc > > > > The result of this for me is that the z component of the transform was > > inverted, but the x and y components are OK. > > > > From experimenting with various simple transforms, it seems that the > > following components are inverted: > > - z translation > > - z rotation > > - x,y,z scale > > - x shear > > > > Has anybody else noticed or dealt with this before? > > > > Thanks, > > Andrew > > _______________________________________________ > > MINC-users at bic.mni.mcgill.ca > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > > > > -- > Best regards, > > Vladimir S. Fonov ~ vladimir fonov gmail com > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From vladimir.fonov at gmail.com Thu Jan 14 17:46:13 2016 From: vladimir.fonov at gmail.com (Vladimir S. FONOV) Date: Thu, 14 Jan 2016 17:46:13 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: Message-ID: <56982535.1050607@gmail.com> This code works properly: make_phantom phantom.mnc param2xfm -translation 10 10 10 trans.xfm # Apply the xfm mincresample -use_input_sampling -invert_transform -transform trans.xfm phantom.mnc out.mnc -clob # Do the same transform in nifti space itk_convert_xfm trans.xfm trans.mat --clob itk_convert phantom.mnc phantom.nii --clob antsApplyTransforms --input phantom.nii \ --transform trans.mat \ --output out.nii \ --reference-image phantom.nii itk_convert out.nii thru_nifti.mnc --clob On 16-01-14 05:04 PM, Andrew Wood wrote: > Hi Vlad, > > I think I didn't explain my issue correctly. Let me > add -invert_transformation to my mincresample invocation and try again. > > > Here are the commands that I think illustrates a problem: > $ make_phantom phantom.mnc > $ param2xfm -translation 10 10 10 trans.xfm > > # Apply the xfm > $ mincresample -use_input_sampling -*invert_transformation* -transform > trans.xfm phantom.mnc out.mnc > > # Do the same transform in nifti space > $ itk_convert_xfm trans.xfm trans.mat > $ mnc2nii phantom.mnc phantom.nii > $ antsApplyTransforms --input phantom.nii \ > --transform trans.mat \ > --output out.nii \ > --reference-image phantom.nii > > # Open result in a minc+nifti-friendly viewer, or convert back to minc > $ nii2mnc out.nii thru_nifti.mnc > $ register out.mnc thru_nifti.mnc > > > > As far as I can tell, out.mnc and thru_nifti.mnc should be identical, but > they clearly are not. > > Best, > Andrew > > On Thu, Jan 14, 2016 at 4:39 PM, Vladimir S. FONOV > wrote: > >> antsApplyTransforms is basically equivalent to mincresample >> -invert_transformation >> >> On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood >> wrote: >> >>> Hi all, >>> >>> I came across a set of transforms generated by ANTs which I've been >> trying >>> to convert and use on minc volumes. There seems to be a bug in one or >> more >>> of the tools I'm using, where applying the transforms to nifti volumes >> does >>> not give the same result as applying them to minc volumes. >>> >>> Likely culprits: >>> - itk_convet_xfm >>> - mnc2nii or nii2mnc >>> - antsApplyTransforms >>> - mincresample >>> >>> Somewhere along the way, several components of the transforms get >> inverted. >>> Here is an example: >>> >>> $ make_phantom phantom.mnc >>> $ param2xfm -translation 10 10 10 trans.xfm >>> >>> # Apply the xfm >>> $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc >> out.mnc >>> >>> # Do the same transform in nifti space >>> $ itk_convert_xfm trans.xfm trans.mat >>> $ mnc2nii phantom.mnc phantom.nii >>> $ antsApplyTransforms --input phantom.nii \ >>> --transform trans.mat \ >>> --output out.nii \ >>> --reference-image phantom.nii >>> >>> # Open result in a minc+nifti-friendly viewer, or convert back to minc >>> $ nii2mnc out.nii thru_nifti.mnc >>> $ register out.mnc thru_nifti.mnc >>> >>> The result of this for me is that the z component of the transform was >>> inverted, but the x and y components are OK. >>> >>> From experimenting with various simple transforms, it seems that the >>> following components are inverted: >>> - z translation >>> - z rotation >>> - x,y,z scale >>> - x shear >>> >>> Has anybody else noticed or dealt with this before? >>> >>> Thanks, >>> Andrew >>> _______________________________________________ >>> MINC-users at bic.mni.mcgill.ca >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >>> >> >> >> >> -- >> Best regards, >> >> Vladimir S. Fonov ~ vladimir fonov gmail com >> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >> > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > -- Best regards, Vladimir S. FONOV ~ vladimir.fonov gmail.com From robert.d.vincent at mcgill.ca Fri Jan 15 08:00:56 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Fri, 15 Jan 2016 08:00:56 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: <56982535.1050607@gmail.com> References: <56982535.1050607@gmail.com> Message-ID: I'll check for issues with the minc to nifti converters... On Thu, Jan 14, 2016 at 5:46 PM, Vladimir S. FONOV wrote: > > This code works properly: > > > > make_phantom phantom.mnc > param2xfm -translation 10 10 10 trans.xfm > > # Apply the xfm > mincresample -use_input_sampling -invert_transform -transform trans.xfm > phantom.mnc out.mnc -clob > > # Do the same transform in nifti space > itk_convert_xfm trans.xfm trans.mat --clob > > itk_convert phantom.mnc phantom.nii --clob > antsApplyTransforms --input phantom.nii \ > --transform trans.mat \ > --output out.nii \ > --reference-image phantom.nii > > itk_convert out.nii thru_nifti.mnc --clob > > > > > > > > > > On 16-01-14 05:04 PM, Andrew Wood wrote: > >> Hi Vlad, >> >> I think I didn't explain my issue correctly. Let me >> add -invert_transformation to my mincresample invocation and try again. >> >> >> Here are the commands that I think illustrates a problem: >> $ make_phantom phantom.mnc >> $ param2xfm -translation 10 10 10 trans.xfm >> >> # Apply the xfm >> $ mincresample -use_input_sampling -*invert_transformation* -transform >> trans.xfm phantom.mnc out.mnc >> >> # Do the same transform in nifti space >> $ itk_convert_xfm trans.xfm trans.mat >> $ mnc2nii phantom.mnc phantom.nii >> $ antsApplyTransforms --input phantom.nii \ >> --transform trans.mat \ >> --output out.nii \ >> --reference-image phantom.nii >> >> # Open result in a minc+nifti-friendly viewer, or convert back to minc >> $ nii2mnc out.nii thru_nifti.mnc >> $ register out.mnc thru_nifti.mnc >> >> >> >> As far as I can tell, out.mnc and thru_nifti.mnc should be identical, but >> they clearly are not. >> >> Best, >> Andrew >> >> On Thu, Jan 14, 2016 at 4:39 PM, Vladimir S. FONOV < >> vladimir.fonov at gmail.com >> >>> wrote: >>> >> >> antsApplyTransforms is basically equivalent to mincresample >>> -invert_transformation >>> >>> On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood >>> wrote: >>> >>> Hi all, >>>> >>>> I came across a set of transforms generated by ANTs which I've been >>>> >>> trying >>> >>>> to convert and use on minc volumes. There seems to be a bug in one or >>>> >>> more >>> >>>> of the tools I'm using, where applying the transforms to nifti volumes >>>> >>> does >>> >>>> not give the same result as applying them to minc volumes. >>>> >>>> Likely culprits: >>>> - itk_convet_xfm >>>> - mnc2nii or nii2mnc >>>> - antsApplyTransforms >>>> - mincresample >>>> >>>> Somewhere along the way, several components of the transforms get >>>> >>> inverted. >>> >>>> Here is an example: >>>> >>>> $ make_phantom phantom.mnc >>>> $ param2xfm -translation 10 10 10 trans.xfm >>>> >>>> # Apply the xfm >>>> $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc >>>> >>> out.mnc >>> >>>> >>>> # Do the same transform in nifti space >>>> $ itk_convert_xfm trans.xfm trans.mat >>>> $ mnc2nii phantom.mnc phantom.nii >>>> $ antsApplyTransforms --input phantom.nii \ >>>> --transform trans.mat \ >>>> --output out.nii \ >>>> --reference-image phantom.nii >>>> >>>> # Open result in a minc+nifti-friendly viewer, or convert back to minc >>>> $ nii2mnc out.nii thru_nifti.mnc >>>> $ register out.mnc thru_nifti.mnc >>>> >>>> The result of this for me is that the z component of the transform was >>>> inverted, but the x and y components are OK. >>>> >>>> From experimenting with various simple transforms, it seems that the >>>> following components are inverted: >>>> - z translation >>>> - z rotation >>>> - x,y,z scale >>>> - x shear >>>> >>>> Has anybody else noticed or dealt with this before? >>>> >>>> Thanks, >>>> Andrew >>>> _______________________________________________ >>>> MINC-users at bic.mni.mcgill.ca >>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >>>> >>>> >>> >>> >>> -- >>> Best regards, >>> >>> Vladimir S. Fonov ~ vladimir fonov gmail com >>> _______________________________________________ >>> MINC-users at bic.mni.mcgill.ca >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >>> >>> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >> >> > > -- > Best regards, > > Vladimir S. FONOV ~ vladimir.fonov gmail.com > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From zijdenbos at gmail.com Sun Jan 17 10:53:16 2016 From: zijdenbos at gmail.com (Alex Zijdenbos) Date: Sun, 17 Jan 2016 10:53:16 -0500 Subject: [MINC-users] Multi-modal image registration In-Reply-To: References: Message-ID: Thanks, Vlad! I'm not sure how I always missed that already being implemented in minctracc :-/ Perhaps I can blame the man page that doesn't mention the -feature_vol option? ;-) -- A On Mon, Jan 11, 2016 at 9:44 AM, Vladimir S. FONOV wrote: > Hello Alex, > > > 1. mintracc can do it, it's even implemented in nlfit_s , > see -sec_source -sec_target -sec_weight > 2. see https://gist.github.com/vfonov/d03db8794181a69a9e66 - it's out of > data, since it uses mincANTS, it will work if you replace mincANTS with > just ANTS > > On Sun, Jan 10, 2016 at 4:25 PM, Alex Zijdenbos > wrote: > > > Hi all, > > > > I am looking for a way to perform multi-modal image registration - i.e., > > perform linear+non-linear alignment while optimizing a similarity metric > > simultaneously based on multiple input volumes. Two specific questions: > > > > 1) minctracc obviously doesn't do this. Is there any chance that anybody > > has, or is working on, generalizing minctracc to multi-modal data? > > > > 2) ANTs does support this, so that may be one avenue to pursue; has > anybody > > perhaps 'translated' the more-or-less standard minctracc registration > > protocols (e.g., nlfit_s) to comparable ANTs invocations? > > > > Any suggestions would be appreciated. > > > > Thanks, > > > > -- A > > _______________________________________________ > > MINC-users at bic.mni.mcgill.ca > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > > > > -- > Best regards, > > Vladimir S. Fonov ~ vladimir fonov gmail com > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > From eskild at gmail.com Mon Jan 18 04:05:29 2016 From: eskild at gmail.com (Simon Eskildsen) Date: Mon, 18 Jan 2016 10:05:29 +0100 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: For what it's worth: I have had similar problems with converting back and forth between nifti and minc. I often find myself tailoring the conversion (flipping, changing dim order / step sign) whenever I need to go back and forth. itk_convert and nii2mnc usually give different results. Quite a nuisance. On Fri, Jan 15, 2016 at 2:00 PM, Robert D. Vincent < robert.d.vincent at mcgill.ca> wrote: > I'll check for issues with the minc to nifti converters... > > > On Thu, Jan 14, 2016 at 5:46 PM, Vladimir S. FONOV < > vladimir.fonov at gmail.com > > wrote: > > > > > This code works properly: > > > > > > > > make_phantom phantom.mnc > > param2xfm -translation 10 10 10 trans.xfm > > > > # Apply the xfm > > mincresample -use_input_sampling -invert_transform -transform trans.xfm > > phantom.mnc out.mnc -clob > > > > # Do the same transform in nifti space > > itk_convert_xfm trans.xfm trans.mat --clob > > > > itk_convert phantom.mnc phantom.nii --clob > > antsApplyTransforms --input phantom.nii \ > > --transform trans.mat \ > > --output out.nii \ > > --reference-image phantom.nii > > > > itk_convert out.nii thru_nifti.mnc --clob > > > > > > > > > > > > > > > > > > > > On 16-01-14 05:04 PM, Andrew Wood wrote: > > > >> Hi Vlad, > >> > >> I think I didn't explain my issue correctly. Let me > >> add -invert_transformation to my mincresample invocation and try again. > >> > >> > >> Here are the commands that I think illustrates a problem: > >> $ make_phantom phantom.mnc > >> $ param2xfm -translation 10 10 10 trans.xfm > >> > >> # Apply the xfm > >> $ mincresample -use_input_sampling -*invert_transformation* -transform > >> trans.xfm phantom.mnc out.mnc > >> > >> # Do the same transform in nifti space > >> $ itk_convert_xfm trans.xfm trans.mat > >> $ mnc2nii phantom.mnc phantom.nii > >> $ antsApplyTransforms --input phantom.nii \ > >> --transform trans.mat \ > >> --output out.nii \ > >> --reference-image phantom.nii > >> > >> # Open result in a minc+nifti-friendly viewer, or convert back to minc > >> $ nii2mnc out.nii thru_nifti.mnc > >> $ register out.mnc thru_nifti.mnc > >> > >> > >> > >> As far as I can tell, out.mnc and thru_nifti.mnc should be identical, > but > >> they clearly are not. > >> > >> Best, > >> Andrew > >> > >> On Thu, Jan 14, 2016 at 4:39 PM, Vladimir S. FONOV < > >> vladimir.fonov at gmail.com > >> > >>> wrote: > >>> > >> > >> antsApplyTransforms is basically equivalent to mincresample > >>> -invert_transformation > >>> > >>> On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood > >>> wrote: > >>> > >>> Hi all, > >>>> > >>>> I came across a set of transforms generated by ANTs which I've been > >>>> > >>> trying > >>> > >>>> to convert and use on minc volumes. There seems to be a bug in one or > >>>> > >>> more > >>> > >>>> of the tools I'm using, where applying the transforms to nifti volumes > >>>> > >>> does > >>> > >>>> not give the same result as applying them to minc volumes. > >>>> > >>>> Likely culprits: > >>>> - itk_convet_xfm > >>>> - mnc2nii or nii2mnc > >>>> - antsApplyTransforms > >>>> - mincresample > >>>> > >>>> Somewhere along the way, several components of the transforms get > >>>> > >>> inverted. > >>> > >>>> Here is an example: > >>>> > >>>> $ make_phantom phantom.mnc > >>>> $ param2xfm -translation 10 10 10 trans.xfm > >>>> > >>>> # Apply the xfm > >>>> $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc > >>>> > >>> out.mnc > >>> > >>>> > >>>> # Do the same transform in nifti space > >>>> $ itk_convert_xfm trans.xfm trans.mat > >>>> $ mnc2nii phantom.mnc phantom.nii > >>>> $ antsApplyTransforms --input phantom.nii \ > >>>> --transform trans.mat \ > >>>> --output out.nii \ > >>>> --reference-image phantom.nii > >>>> > >>>> # Open result in a minc+nifti-friendly viewer, or convert back to minc > >>>> $ nii2mnc out.nii thru_nifti.mnc > >>>> $ register out.mnc thru_nifti.mnc > >>>> > >>>> The result of this for me is that the z component of the transform was > >>>> inverted, but the x and y components are OK. > >>>> > >>>> From experimenting with various simple transforms, it seems that the > >>>> following components are inverted: > >>>> - z translation > >>>> - z rotation > >>>> - x,y,z scale > >>>> - x shear > >>>> > >>>> Has anybody else noticed or dealt with this before? > >>>> > >>>> Thanks, > >>>> Andrew > >>>> _______________________________________________ > >>>> MINC-users at bic.mni.mcgill.ca > >>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > >>>> > >>>> > >>> > >>> > >>> -- > >>> Best regards, > >>> > >>> Vladimir S. Fonov ~ vladimir fonov gmail com > >>> _______________________________________________ > >>> MINC-users at bic.mni.mcgill.ca > >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > >>> > >>> _______________________________________________ > >> MINC-users at bic.mni.mcgill.ca > >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > >> > >> > > > > -- > > Best regards, > > > > Vladimir S. FONOV ~ vladimir.fonov gmail.com > > _______________________________________________ > > MINC-users at bic.mni.mcgill.ca > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From vladimir.fonov at gmail.com Mon Jan 18 09:38:30 2016 From: vladimir.fonov at gmail.com (Vladimir S. FONOV) Date: Mon, 18 Jan 2016 09:38:30 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: at least both itk_convert and itk_convert_xfm seem to give consistent results. On Mon, Jan 18, 2016 at 4:05 AM, Simon Eskildsen wrote: > For what it's worth: I have had similar problems with converting back and > forth between nifti and minc. I often find myself tailoring the conversion > (flipping, changing dim order / step sign) whenever I need to go back and > forth. itk_convert and nii2mnc usually give different results. Quite a > nuisance. > > On Fri, Jan 15, 2016 at 2:00 PM, Robert D. Vincent < > robert.d.vincent at mcgill.ca> wrote: > > > I'll check for issues with the minc to nifti converters... > > > > > > On Thu, Jan 14, 2016 at 5:46 PM, Vladimir S. FONOV < > > vladimir.fonov at gmail.com > > > wrote: > > > > > > > > This code works properly: > > > > > > > > > > > > make_phantom phantom.mnc > > > param2xfm -translation 10 10 10 trans.xfm > > > > > > # Apply the xfm > > > mincresample -use_input_sampling -invert_transform -transform trans.xfm > > > phantom.mnc out.mnc -clob > > > > > > # Do the same transform in nifti space > > > itk_convert_xfm trans.xfm trans.mat --clob > > > > > > itk_convert phantom.mnc phantom.nii --clob > > > antsApplyTransforms --input phantom.nii \ > > > --transform trans.mat \ > > > --output out.nii \ > > > --reference-image phantom.nii > > > > > > itk_convert out.nii thru_nifti.mnc --clob > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 16-01-14 05:04 PM, Andrew Wood wrote: > > > > > >> Hi Vlad, > > >> > > >> I think I didn't explain my issue correctly. Let me > > >> add -invert_transformation to my mincresample invocation and try > again. > > >> > > >> > > >> Here are the commands that I think illustrates a problem: > > >> $ make_phantom phantom.mnc > > >> $ param2xfm -translation 10 10 10 trans.xfm > > >> > > >> # Apply the xfm > > >> $ mincresample -use_input_sampling -*invert_transformation* -transform > > >> trans.xfm phantom.mnc out.mnc > > >> > > >> # Do the same transform in nifti space > > >> $ itk_convert_xfm trans.xfm trans.mat > > >> $ mnc2nii phantom.mnc phantom.nii > > >> $ antsApplyTransforms --input phantom.nii \ > > >> --transform trans.mat \ > > >> --output out.nii \ > > >> --reference-image phantom.nii > > >> > > >> # Open result in a minc+nifti-friendly viewer, or convert back to minc > > >> $ nii2mnc out.nii thru_nifti.mnc > > >> $ register out.mnc thru_nifti.mnc > > >> > > >> > > >> > > >> As far as I can tell, out.mnc and thru_nifti.mnc should be identical, > > but > > >> they clearly are not. > > >> > > >> Best, > > >> Andrew > > >> > > >> On Thu, Jan 14, 2016 at 4:39 PM, Vladimir S. FONOV < > > >> vladimir.fonov at gmail.com > > >> > > >>> wrote: > > >>> > > >> > > >> antsApplyTransforms is basically equivalent to mincresample > > >>> -invert_transformation > > >>> > > >>> On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood > > > >>> wrote: > > >>> > > >>> Hi all, > > >>>> > > >>>> I came across a set of transforms generated by ANTs which I've been > > >>>> > > >>> trying > > >>> > > >>>> to convert and use on minc volumes. There seems to be a bug in one > or > > >>>> > > >>> more > > >>> > > >>>> of the tools I'm using, where applying the transforms to nifti > volumes > > >>>> > > >>> does > > >>> > > >>>> not give the same result as applying them to minc volumes. > > >>>> > > >>>> Likely culprits: > > >>>> - itk_convet_xfm > > >>>> - mnc2nii or nii2mnc > > >>>> - antsApplyTransforms > > >>>> - mincresample > > >>>> > > >>>> Somewhere along the way, several components of the transforms get > > >>>> > > >>> inverted. > > >>> > > >>>> Here is an example: > > >>>> > > >>>> $ make_phantom phantom.mnc > > >>>> $ param2xfm -translation 10 10 10 trans.xfm > > >>>> > > >>>> # Apply the xfm > > >>>> $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc > > >>>> > > >>> out.mnc > > >>> > > >>>> > > >>>> # Do the same transform in nifti space > > >>>> $ itk_convert_xfm trans.xfm trans.mat > > >>>> $ mnc2nii phantom.mnc phantom.nii > > >>>> $ antsApplyTransforms --input phantom.nii \ > > >>>> --transform trans.mat \ > > >>>> --output out.nii \ > > >>>> --reference-image phantom.nii > > >>>> > > >>>> # Open result in a minc+nifti-friendly viewer, or convert back to > minc > > >>>> $ nii2mnc out.nii thru_nifti.mnc > > >>>> $ register out.mnc thru_nifti.mnc > > >>>> > > >>>> The result of this for me is that the z component of the transform > was > > >>>> inverted, but the x and y components are OK. > > >>>> > > >>>> From experimenting with various simple transforms, it seems that > the > > >>>> following components are inverted: > > >>>> - z translation > > >>>> - z rotation > > >>>> - x,y,z scale > > >>>> - x shear > > >>>> > > >>>> Has anybody else noticed or dealt with this before? > > >>>> > > >>>> Thanks, > > >>>> Andrew > > >>>> _______________________________________________ > > >>>> MINC-users at bic.mni.mcgill.ca > > >>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > >>>> > > >>>> > > >>> > > >>> > > >>> -- > > >>> Best regards, > > >>> > > >>> Vladimir S. Fonov ~ vladimir fonov gmail com > > >>> _______________________________________________ > > >>> MINC-users at bic.mni.mcgill.ca > > >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > >>> > > >>> _______________________________________________ > > >> MINC-users at bic.mni.mcgill.ca > > >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > >> > > >> > > > > > > -- > > > Best regards, > > > > > > Vladimir S. FONOV ~ vladimir.fonov gmail.com > > > _______________________________________________ > > > MINC-users at bic.mni.mcgill.ca > > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > > > _______________________________________________ > > MINC-users at bic.mni.mcgill.ca > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > -- Best regards, Vladimir S. Fonov ~ vladimir fonov gmail com From zijdenbos at gmail.com Mon Jan 18 15:07:37 2016 From: zijdenbos at gmail.com (Alex Zijdenbos) Date: Mon, 18 Jan 2016 15:07:37 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: However, itk_convert seems to suffer from a number of issues itself. - it does not appear to pay attention to the MINC_COMPRESS env var, so MINC output is not internally compressed (ugh!) - it does not insert a history attribute, so minchistory doesn't like the generated volumes - it does not preserve the data type. From a few quick experiments, it seems that any MINC volume that is not "unsigned byte 0 to 1" is converted to a float NifTI volume. Not sure about the reverse direction. Is Kitware friendly with Seagate? ;-) The latter point applies to nii2mnc/mnc2nii as well by the way; neither converter seems to preserve the file data type, or only does it in certain situations. It's not clear to me what the logic behind that is. Avoiding issues due to slice-based scaling perhaps? I have now gotten to write an nii2mnc/mnc2nii wrapper that uses itk_convert with some mincreshape to fix the above issues; hoping that nii2mnc/mnc2nii can be improved. -- A From vladimir.fonov at gmail.com Mon Jan 18 15:17:11 2016 From: vladimir.fonov at gmail.com (Vladimir S. FONOV) Date: Mon, 18 Jan 2016 15:17:11 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: <569D4847.2040007@gmail.com> It depends on the version of itk_convert that you are using. On 16-01-18 03:07 PM, Alex Zijdenbos wrote: > However, itk_convert seems to suffer from a number of issues itself. > > - it does not appear to pay attention to the MINC_COMPRESS env var, so MINC > output is not internally compressed (ugh!) > - it does not insert a history attribute, so minchistory doesn't like the > generated volumes > - it does not preserve the data type. From a few quick experiments, it > seems that any MINC volume that is not "unsigned byte 0 to 1" is converted > to a float NifTI volume. Not sure about the reverse direction. Is Kitware > friendly with Seagate? ;-) > > The latter point applies to nii2mnc/mnc2nii as well by the way; neither > converter seems to preserve the file data type, or only does it in certain > situations. It's not clear to me what the logic behind that is. Avoiding > issues due to slice-based scaling perhaps? > > I have now gotten to write an nii2mnc/mnc2nii wrapper that uses itk_convert > with some mincreshape to fix the above issues; hoping that nii2mnc/mnc2nii > can be improved. > > -- A > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > -- Best regards, Vladimir S. FONOV ~ vladimir.fonov gmail.com From robert.d.vincent at mcgill.ca Mon Jan 18 15:18:52 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Mon, 18 Jan 2016 15:18:52 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: Hi Alex, I have a long missive about some related issues that is awaiting moderation... But to address the question about data types, part of the problem is that NIfTI defines a global floating-point slope and offset that is applied to _all_ voxel values, but there is no provision for per-slice scaling. Therefore nii2mnc can easily preserve the voxel data type, however, mnc2nii has to do quite a bit of work to determine if the data type can be preserved without losing precision. I think the default behavior was therefore just to convert everything to float. -bert On Mon, Jan 18, 2016 at 3:07 PM, Alex Zijdenbos wrote: > However, itk_convert seems to suffer from a number of issues itself. > > - it does not appear to pay attention to the MINC_COMPRESS env var, so MINC > output is not internally compressed (ugh!) > - it does not insert a history attribute, so minchistory doesn't like the > generated volumes > - it does not preserve the data type. From a few quick experiments, it > seems that any MINC volume that is not "unsigned byte 0 to 1" is converted > to a float NifTI volume. Not sure about the reverse direction. Is Kitware > friendly with Seagate? ;-) > > The latter point applies to nii2mnc/mnc2nii as well by the way; neither > converter seems to preserve the file data type, or only does it in certain > situations. It's not clear to me what the logic behind that is. Avoiding > issues due to slice-based scaling perhaps? > > I have now gotten to write an nii2mnc/mnc2nii wrapper that uses itk_convert > with some mincreshape to fix the above issues; hoping that nii2mnc/mnc2nii > can be improved. > > -- A > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From robert.d.vincent at mcgill.ca Mon Jan 18 15:46:41 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Mon, 18 Jan 2016 15:46:41 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: Hi all, My apologies for the lengthy message. There may well be issues with the mnc2nii/nii2mnc pair, but part of the problem may be that itk_convert doesn't obey one of MINC's conventions, which is that direction_cosines are not supposed to encode axis flipping information. In some cases, itk_convert can create a MINC file with direction cosines of [-1, 0, 0]. These might not be handled correctly in some MINC tools. Here's what I mean, illustrated using one of the standard NIfTI example files: % wget http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_RL_nifti.nii.gz % itk_convert avg152T1_RL_nifti.nii.gz RL.mnc % mincinfo RL.mnc file: RL.mnc image: unsigned byte 0 to 255 image dimensions: xspace yspace zspace dimension name length step start -------------- ------ ---- ----- xspace 91 2 -90 yspace 109 2 -126 zspace 91 2 -72 % mincinfo -attvalue xspace:direction_cosines RL.mnc -1 0 0 That -1 apparently means that the X axis is flipped, but MINC assumes that any flipping is encoded in the step size. I'm sure itk_convert is internally consistent, so of course it works just fine in many cases. There are also inconsistencies between the "NIfTI-world" coordinate system in Andrew's example and the MINC coordinate system. Again using the NIfTI example file, I tried the following: % make_transform 10 10 10 trans.xfm % itk_convert_xfm trans.xfm trans.mat % antsApplyTransforms --input avg152T1_RL_nifti.nii --transform trans.mat --output out.nii --reference-image avg152T1_RL_nifti.nii % fslview avg152T1_RL_nifti.nii out.nii The transformation moves the image in the +X and +Y direction, but in the -Z direction (see the enclosed screen capture - the original image is blue, the transformed image is red). Given the original transform, I would have expected that the signs of all three components of the transform would be negative. This example uses no MINC tools other than make_transform, so I suspect that there is some inconsistency between MINC's coordinate system and the coordinate system assumed in itk_convert_xfm or antsApplyTransforms. By way of comparison, performing the same transform using mincresample (using -invert_transformation) moves the image -10 in X, -10 in Y, and -10 in Z (at least according to the MINC conventions for these directions: MINC's convention is for X to increase from patient left to patient right, Y from patient posterior to patient anterior, and Z from patient inferior to patient superior). -bert ? Screenshot from 2016-01-18 11:31:20.png ? On Mon, Jan 18, 2016 at 3:18 PM, Robert D. Vincent < robert.d.vincent at mcgill.ca> wrote: > Hi Alex, > > I have a long missive about some related issues that is awaiting > moderation... > > But to address the question about data types, part of the problem is that > NIfTI defines a global floating-point slope and offset that is applied to > _all_ voxel values, but there is no provision for per-slice scaling. > Therefore nii2mnc can easily preserve the voxel data type, however, mnc2nii > has to do quite a bit of work to determine if the data type can be > preserved without losing precision. I think the default behavior was > therefore just to convert everything to float. > > -bert > > On Mon, Jan 18, 2016 at 3:07 PM, Alex Zijdenbos > wrote: > >> However, itk_convert seems to suffer from a number of issues itself. >> >> - it does not appear to pay attention to the MINC_COMPRESS env var, so >> MINC >> output is not internally compressed (ugh!) >> - it does not insert a history attribute, so minchistory doesn't like the >> generated volumes >> - it does not preserve the data type. From a few quick experiments, it >> seems that any MINC volume that is not "unsigned byte 0 to 1" is converted >> to a float NifTI volume. Not sure about the reverse direction. Is Kitware >> friendly with Seagate? ;-) >> >> The latter point applies to nii2mnc/mnc2nii as well by the way; neither >> converter seems to preserve the file data type, or only does it in certain >> situations. It's not clear to me what the logic behind that is. Avoiding >> issues due to slice-based scaling perhaps? >> >> I have now gotten to write an nii2mnc/mnc2nii wrapper that uses >> itk_convert >> with some mincreshape to fix the above issues; hoping that nii2mnc/mnc2nii >> can be improved. >> >> -- A >> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >> > > From robert.d.vincent at mcgill.ca Mon Jan 18 12:13:35 2016 From: robert.d.vincent at mcgill.ca (Robert D. Vincent) Date: Mon, 18 Jan 2016 12:13:35 -0500 Subject: [MINC-users] Issue with itk_convert_xfm In-Reply-To: References: <56982535.1050607@gmail.com> Message-ID: Hi all, My apologies for the lengthy message. There may well be issues with the mnc2nii/nii2mnc pair, but part of the problem may be that itk_convert doesn't obey one of MINC's conventions, which is that direction_cosines are not supposed to encode axis flipping information. In some cases, itk_convert can create a MINC file with direction cosines of [-1, 0, 0]. These might not be handled correctly in some MINC tools. Here's what I mean, illustrated using one of the standard NIfTI example files: % wget http://nifti.nimh.nih.gov/nifti-1/data/avg152T1_RL_nifti.nii.gz % itk_convert avg152T1_RL_nifti.nii.gz RL.mnc % mincinfo RL.mnc file: RL.mnc image: unsigned byte 0 to 255 image dimensions: xspace yspace zspace dimension name length step start -------------- ------ ---- ----- xspace 91 2 -90 yspace 109 2 -126 zspace 91 2 -72 % mincinfo -attvalue xspace:direction_cosines RL.mnc -1 0 0 That -1 apparently means that the X axis is flipped, but MINC assumes that any flipping is encoded in the step size. I'm sure itk_convert is internally consistent, so of course it works just fine in many cases. There are also inconsistencies between the "NIfTI-world" coordinate system in Andrew's example and the MINC coordinate system. Again using the NIfTI example file, I tried the following: % make_transform 10 10 10 trans.xfm % itk_convert_xfm trans.xfm trans.mat % antsApplyTransforms --input avg152T1_RL_nifti.nii --transform trans.mat --output out.nii --reference-image avg152T1_RL_nifti.nii % fslview avg152T1_RL_nifti.nii out.nii The transformation moves the image in the +X and +Y direction, but in the -Z direction (see the enclosed screen capture - the original image is blue, the transformed image is red). Given the original transform, I would have expected that the signs of all three components of the transform would be negative. This example uses no MINC tools other than make_transform, so I suspect that there is some inconsistency between MINC's coordinate system and the coordinate system assumed in itk_convert_xfm or antsApplyTransforms. By way of comparison, performing the same transform using mincresample (using -invert_transformation) moves the image -10 in X, -10 in Y, and -10 in Z (at least according to the MINC conventions for these directions: MINC's convention is for X to increase from patient left to patient right, Y from patient posterior to patient anterior, and Z from patient inferior to patient superior). -bert On Mon, Jan 18, 2016 at 4:05 AM, Simon Eskildsen wrote: > For what it's worth: I have had similar problems with converting back and > forth between nifti and minc. I often find myself tailoring the conversion > (flipping, changing dim order / step sign) whenever I need to go back and > forth. itk_convert and nii2mnc usually give different results. Quite a > nuisance. > > On Fri, Jan 15, 2016 at 2:00 PM, Robert D. Vincent < > robert.d.vincent at mcgill.ca> wrote: > > > I'll check for issues with the minc to nifti converters... > > > > > > On Thu, Jan 14, 2016 at 5:46 PM, Vladimir S. FONOV < > > vladimir.fonov at gmail.com > > > wrote: > > > > > > > > This code works properly: > > > > > > > > > > > > make_phantom phantom.mnc > > > param2xfm -translation 10 10 10 trans.xfm > > > > > > # Apply the xfm > > > mincresample -use_input_sampling -invert_transform -transform trans.xfm > > > phantom.mnc out.mnc -clob > > > > > > # Do the same transform in nifti space > > > itk_convert_xfm trans.xfm trans.mat --clob > > > > > > itk_convert phantom.mnc phantom.nii --clob > > > antsApplyTransforms --input phantom.nii \ > > > --transform trans.mat \ > > > --output out.nii \ > > > --reference-image phantom.nii > > > > > > itk_convert out.nii thru_nifti.mnc --clob > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 16-01-14 05:04 PM, Andrew Wood wrote: > > > > > >> Hi Vlad, > > >> > > >> I think I didn't explain my issue correctly. Let me > > >> add -invert_transformation to my mincresample invocation and try > again. > > >> > > >> > > >> Here are the commands that I think illustrates a problem: > > >> $ make_phantom phantom.mnc > > >> $ param2xfm -translation 10 10 10 trans.xfm > > >> > > >> # Apply the xfm > > >> $ mincresample -use_input_sampling -*invert_transformation* -transform > > >> trans.xfm phantom.mnc out.mnc > > >> > > >> # Do the same transform in nifti space > > >> $ itk_convert_xfm trans.xfm trans.mat > > >> $ mnc2nii phantom.mnc phantom.nii > > >> $ antsApplyTransforms --input phantom.nii \ > > >> --transform trans.mat \ > > >> --output out.nii \ > > >> --reference-image phantom.nii > > >> > > >> # Open result in a minc+nifti-friendly viewer, or convert back to minc > > >> $ nii2mnc out.nii thru_nifti.mnc > > >> $ register out.mnc thru_nifti.mnc > > >> > > >> > > >> > > >> As far as I can tell, out.mnc and thru_nifti.mnc should be identical, > > but > > >> they clearly are not. > > >> > > >> Best, > > >> Andrew > > >> > > >> On Thu, Jan 14, 2016 at 4:39 PM, Vladimir S. FONOV < > > >> vladimir.fonov at gmail.com > > >> > > >>> wrote: > > >>> > > >> > > >> antsApplyTransforms is basically equivalent to mincresample > > >>> -invert_transformation > > >>> > > >>> On Thu, Jan 14, 2016 at 3:18 PM, Andrew Wood > > > >>> wrote: > > >>> > > >>> Hi all, > > >>>> > > >>>> I came across a set of transforms generated by ANTs which I've been > > >>>> > > >>> trying > > >>> > > >>>> to convert and use on minc volumes. There seems to be a bug in one > or > > >>>> > > >>> more > > >>> > > >>>> of the tools I'm using, where applying the transforms to nifti > volumes > > >>>> > > >>> does > > >>> > > >>>> not give the same result as applying them to minc volumes. > > >>>> > > >>>> Likely culprits: > > >>>> - itk_convet_xfm > > >>>> - mnc2nii or nii2mnc > > >>>> - antsApplyTransforms > > >>>> - mincresample > > >>>> > > >>>> Somewhere along the way, several components of the transforms get > > >>>> > > >>> inverted. > > >>> > > >>>> Here is an example: > > >>>> > > >>>> $ make_phantom phantom.mnc > > >>>> $ param2xfm -translation 10 10 10 trans.xfm > > >>>> > > >>>> # Apply the xfm > > >>>> $ mincresample -use_input_sampling -transform trans.xfm phantom.mnc > > >>>> > > >>> out.mnc > > >>> > > >>>> > > >>>> # Do the same transform in nifti space > > >>>> $ itk_convert_xfm trans.xfm trans.mat > > >>>> $ mnc2nii phantom.mnc phantom.nii > > >>>> $ antsApplyTransforms --input phantom.nii \ > > >>>> --transform trans.mat \ > > >>>> --output out.nii \ > > >>>> --reference-image phantom.nii > > >>>> > > >>>> # Open result in a minc+nifti-friendly viewer, or convert back to > minc > > >>>> $ nii2mnc out.nii thru_nifti.mnc > > >>>> $ register out.mnc thru_nifti.mnc > > >>>> > > >>>> The result of this for me is that the z component of the transform > was > > >>>> inverted, but the x and y components are OK. > > >>>> > > >>>> From experimenting with various simple transforms, it seems that > the > > >>>> following components are inverted: > > >>>> - z translation > > >>>> - z rotation > > >>>> - x,y,z scale > > >>>> - x shear > > >>>> > > >>>> Has anybody else noticed or dealt with this before? > > >>>> > > >>>> Thanks, > > >>>> Andrew > > >>>> _______________________________________________ > > >>>> MINC-users at bic.mni.mcgill.ca > > >>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > >>>> > > >>>> > > >>> > > >>> > > >>> -- > > >>> Best regards, > > >>> > > >>> Vladimir S. Fonov ~ vladimir fonov gmail com > > >>> _______________________________________________ > > >>> MINC-users at bic.mni.mcgill.ca > > >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > >>> > > >>> _______________________________________________ > > >> MINC-users at bic.mni.mcgill.ca > > >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > >> > > >> > > > > > > -- > > > Best regards, > > > > > > Vladimir S. FONOV ~ vladimir.fonov gmail.com > > > _______________________________________________ > > > MINC-users at bic.mni.mcgill.ca > > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > > > _______________________________________________ > > MINC-users at bic.mni.mcgill.ca > > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > > > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From pgravel at bic.mni.mcgill.ca Thu Jan 28 14:38:23 2016 From: pgravel at bic.mni.mcgill.ca (Paul GRAVEL) Date: Thu, 28 Jan 2016 14:38:23 -0500 (EST) Subject: [MINC-users] Co-registration metric (minctracc) In-Reply-To: <20060616113947.n15sklotwcw4ksk8@webmail.mcgill.ca> References: <20060616113947.n15sklotwcw4ksk8@webmail.mcgill.ca> Message-ID: Dear All, Hope all is well! Is there a metric (or metrics) to test the goodness of co-registration with minctracc (would that be comparing the Initial objective function val vs. Final objective function value)? The reason for this question is that I am running a script that does 2 passes of a PET to PET co-registration, but sometimes the second pass messes things up, especially when the first pass looks good. Thus I would like to use this metric to automatically check whether or not the second pass should be run at all. Of course, I would still visually inspect the end results ;-)! Thanks! Paul From a.janke at gmail.com Thu Jan 28 17:07:27 2016 From: a.janke at gmail.com (Andrew Janke) Date: Fri, 29 Jan 2016 08:07:27 +1000 Subject: [MINC-users] Co-registration metric (minctracc) In-Reply-To: References: <20060616113947.n15sklotwcw4ksk8@webmail.mcgill.ca> Message-ID: Hi Paul, Yes the output of minctracc should be able to help you. Just be aware that if you are running minctracc within something else (nlpfit, mritotal, etc) in which step sizes and other things change that the correlation will also change. You might also be interested in minccmp, I added it some time ago for this express purpose. a On 29 January 2016 at 05:38, Paul GRAVEL wrote: > Dear All, > > Hope all is well! > > Is there a metric (or metrics) to test the goodness of co-registration with > minctracc (would that be comparing the Initial objective function val vs. > Final objective function value)? > > The reason for this question is that I am running a script that does 2 > passes of a PET to PET co-registration, but sometimes the second pass messes > things up, especially when the first pass looks good. > Thus I would like to use this metric to automatically check whether or not > the second pass should be run at all. > Of course, I would still visually inspect the end results ;-)! > > Thanks! > > Paul > > > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users From pgravel at bic.mni.mcgill.ca Thu Jan 28 19:05:56 2016 From: pgravel at bic.mni.mcgill.ca (Paul GRAVEL) Date: Thu, 28 Jan 2016 19:05:56 -0500 (EST) Subject: [MINC-users] Co-registration metric (minctracc) In-Reply-To: References: <20060616113947.n15sklotwcw4ksk8@webmail.mcgill.ca> Message-ID: Many thanks Andrew! I gave it a try, and it looks promising! btw, is there a way to floor each volume with different values? Best, Paul On Fri, 29 Jan 2016, Andrew Janke wrote: > Hi Paul, > > Yes the output of minctracc should be able to help you. Just be aware > that if you are running minctracc within something else (nlpfit, > mritotal, etc) in which step sizes and other things change that the > correlation will also change. > > You might also be interested in minccmp, I added it some time ago for > this express purpose. > > > a > > > On 29 January 2016 at 05:38, Paul GRAVEL wrote: >> Dear All, >> >> Hope all is well! >> >> Is there a metric (or metrics) to test the goodness of co-registration with >> minctracc (would that be comparing the Initial objective function val vs. >> Final objective function value)? >> >> The reason for this question is that I am running a script that does 2 >> passes of a PET to PET co-registration, but sometimes the second pass messes >> things up, especially when the first pass looks good. >> Thus I would like to use this metric to automatically check whether or not >> the second pass should be run at all. >> Of course, I would still visually inspect the end results ;-)! >> >> Thanks! >> >> Paul >> >> >> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > From a.janke at gmail.com Thu Jan 28 19:19:13 2016 From: a.janke at gmail.com (Andrew Janke) Date: Fri, 29 Jan 2016 10:19:13 +1000 Subject: [MINC-users] Co-registration metric (minctracc) In-Reply-To: References: <20060616113947.n15sklotwcw4ksk8@webmail.mcgill.ca> Message-ID: Not as of yet. Looking at the code it would seem that the floor value only applies to the first input volume. https://github.com/BIC-MNI/minc/blob/master/progs/minccmp/minccmp.c#L333 It would not be a hard change to make, the code for dealing with ranges of input values is already in mincstats. For now I'd suggest a first pass through with minccalc setting values in the first to 0 if the second is below a floor value. In the example below the floor values are: input1.mnc 12.5 input2.mnc 23.5 minccalc -expression "(A[1] < 23.5) ? 0 : A[0]" input1.mnc input2.mnc input1-floor.mnc minccmp -floor 12.5 input1-floor.mnc input2.mnc a On 29 January 2016 at 10:05, Paul GRAVEL wrote: > Many thanks Andrew! > > I gave it a try, and it looks promising! > btw, is there a way to floor each volume with different values? > > Best, > > Paul > > > > On Fri, 29 Jan 2016, Andrew Janke wrote: > >> Hi Paul, >> >> Yes the output of minctracc should be able to help you. Just be aware >> that if you are running minctracc within something else (nlpfit, >> mritotal, etc) in which step sizes and other things change that the >> correlation will also change. >> >> You might also be interested in minccmp, I added it some time ago for >> this express purpose. >> >> >> a >> >> >> On 29 January 2016 at 05:38, Paul GRAVEL >> wrote: >>> >>> Dear All, >>> >>> Hope all is well! >>> >>> Is there a metric (or metrics) to test the goodness of co-registration >>> with >>> minctracc (would that be comparing the Initial objective function val vs. >>> Final objective function value)? >>> >>> The reason for this question is that I am running a script that does 2 >>> passes of a PET to PET co-registration, but sometimes the second pass >>> messes >>> things up, especially when the first pass looks good. >>> Thus I would like to use this metric to automatically check whether or >>> not >>> the second pass should be run at all. >>> Of course, I would still visually inspect the end results ;-)! >>> >>> Thanks! >>> >>> Paul >>> >>> >>> _______________________________________________ >>> MINC-users at bic.mni.mcgill.ca >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >> >> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >> > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users From pgravel at bic.mni.mcgill.ca Thu Jan 28 19:24:21 2016 From: pgravel at bic.mni.mcgill.ca (Paul GRAVEL) Date: Thu, 28 Jan 2016 19:24:21 -0500 (EST) Subject: [MINC-users] Co-registration metric (minctracc) In-Reply-To: References: <20060616113947.n15sklotwcw4ksk8@webmail.mcgill.ca> Message-ID: Great idea! Many thanks again! Paul On Fri, 29 Jan 2016, Andrew Janke wrote: > Not as of yet. Looking at the code it would seem that the floor value > only applies to the first input volume. > > https://github.com/BIC-MNI/minc/blob/master/progs/minccmp/minccmp.c#L333 > > It would not be a hard change to make, the code for dealing with > ranges of input values is already in mincstats. > > For now I'd suggest a first pass through with minccalc setting values > in the first to 0 if the second is below a floor value. In the > example below the floor values are: > > input1.mnc 12.5 > input2.mnc 23.5 > > minccalc -expression "(A[1] < 23.5) ? 0 : A[0]" input1.mnc > input2.mnc input1-floor.mnc > > minccmp -floor 12.5 input1-floor.mnc input2.mnc > > > a > > > On 29 January 2016 at 10:05, Paul GRAVEL wrote: >> Many thanks Andrew! >> >> I gave it a try, and it looks promising! >> btw, is there a way to floor each volume with different values? >> >> Best, >> >> Paul >> >> >> >> On Fri, 29 Jan 2016, Andrew Janke wrote: >> >>> Hi Paul, >>> >>> Yes the output of minctracc should be able to help you. Just be aware >>> that if you are running minctracc within something else (nlpfit, >>> mritotal, etc) in which step sizes and other things change that the >>> correlation will also change. >>> >>> You might also be interested in minccmp, I added it some time ago for >>> this express purpose. >>> >>> >>> a >>> >>> >>> On 29 January 2016 at 05:38, Paul GRAVEL >>> wrote: >>>> >>>> Dear All, >>>> >>>> Hope all is well! >>>> >>>> Is there a metric (or metrics) to test the goodness of co-registration >>>> with >>>> minctracc (would that be comparing the Initial objective function val vs. >>>> Final objective function value)? >>>> >>>> The reason for this question is that I am running a script that does 2 >>>> passes of a PET to PET co-registration, but sometimes the second pass >>>> messes >>>> things up, especially when the first pass looks good. >>>> Thus I would like to use this metric to automatically check whether or >>>> not >>>> the second pass should be run at all. >>>> Of course, I would still visually inspect the end results ;-)! >>>> >>>> Thanks! >>>> >>>> Paul >>>> >>>> >>>> _______________________________________________ >>>> MINC-users at bic.mni.mcgill.ca >>>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >>> >>> _______________________________________________ >>> MINC-users at bic.mni.mcgill.ca >>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >>> >> _______________________________________________ >> MINC-users at bic.mni.mcgill.ca >> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users > _______________________________________________ > MINC-users at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users >