users > Mapping single points under transformations
Showing 1-13 of 13 posts
Display:
Results per page:
Oct 23, 2012  01:10 PM | Ruben Portugues
Mapping single points under transformations
I have a .xform transformation file that maps one volume into another, but I am interested in seeing where a particular (x,y,z) point is mapped onto. Is there a tool/command that allows me to do this i.e. input a 3 column txt file of (x,y,z) triplets and it will output a .txt file of mapped triplets.  
Thanks.
Oct 23, 2012  04:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
Hi Ruben:

The "streamxform" tool does exactly what you want. It reads one vector, "x y z" (no commas, just spaces or tabs!) per line from Standard Input, applies a transformation (or a series of concatenated transformations) to each, and writes the transformed vectors to Standard Output.

Torsten
Oct 23, 2012  04:10 PM | Ruben Portugues
RE: Mapping single points under transformations
Wonderful, thanks! 
I also want to ask: if we use the cmtk library of our research, how do you want us to reference/cite it?
Oct 23, 2012  05:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
Happy to help.

Regarding reference/citation - my preference would be:

a) for the software as such - mention "The Computational Morphometry Toolkit (CMTK)" in the Acknowledgments and also provide URL (http://nitrc.org/projects/cmtk). The exact wording doesn't matter - whatever sounds good to you is probably okay. :)

b) if any of the algorithms implemented by the software are central to your research, also cite the respective methods papers, just like you would any other references. A slightly outdated list of papers by CMTK tool is here: https://neuro.sri.com/cmtk/wiki/index.ph...

Best,
  Torsten
Oct 23, 2012  05:10 PM | Ruben Portugues
RE: Mapping single points under transformations
Great.
I have one more question which has taken me over 30 minutes to try to find the answer to and I am sure you know the answer immediately.  I have been trying to figure out the syntax of streamxform (or grexform) and failed.  What is the correct syntax if I have a transformation file "warp.xform", an input file of points "input.list" (which has rows i=1:n that are "x_i y_i z_i") and I want the output file to be "output.list". 
I searched online but failed to find a help page.  Again, thanks.
Oct 23, 2012  05:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
First things first -- please try to stay away from "gregxform." It's old, it's messy, it's deprecated, and it may be on its way out of CMTK altogether (Greg, if you're reading this: sorry!)

Now, given your file names, the use of streamxform should be like so:
cmtk streamxform warp.xform < input.list > output.list


If you want your input/output files compressed, you could also use:
gzip -cd input.list.gz | cmtk streamxform warp.xform | gzip -9c > output.list.gz


Finally, if you want to apply the inverse of your transformation (you likely need to do this if you are trying to transform coordinates from moving image space into fixed image space):
cmtk streamxform -- --inverse warp.xform < input.list > output.list

(Note the "--" preceding "--inverse"!).

Hope this helps (and hope I am not stupidly missing something here) ;)
Oct 23, 2012  06:10 PM | Ruben Portugues
RE: Mapping single points under transformations
This works (almost) wonderfully, and no, you are not missing something, I am sometimes a bit slow.

If I run gregxform from my previous 2.1 version it all runs fine now using the syntax you describe.
I just downloaded cmtk version 2.2.5 for windows to get streamxform.  When I try to run it (or gregxform from this version) I get an error message:
"The program can't start because libfftw3-3.dll is mising form your computer.  Try reinstalling the program to fix this problem"
This must be a problem just with this new version's installation.  Have I installed it incorrectly?
Oct 23, 2012  07:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
Ah, bummer - no, you did everything right. CMTK now uses FFTW, but the necessary library isn't bundled in the package. I will need to look into what the best way is to fix this.

Sorry for the inconvenience.

TR
Oct 23, 2012  08:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
Ruben:

I just uploaded two new Windows packages to the Downloads area (same file names). These include the FFTW library dll and should resolve your problem.

Best,
  Torsten
Oct 24, 2012  12:10 PM | Ruben Portugues
RE: Mapping single points under transformations
Hi Torsten,
I have had no luck: I reinstalled cmtk2.2 from the new files and I still get the same problem.  I will continue trying just in case the mistake is on my side.  Best,
Ruben
Oct 24, 2012  05:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
Ruben:

Can you check whether your new install has a file "libfftw3-3.dll" file in the bin/ directory (where all the command line tools are also located)? If  not, please check what .dll files are there at all (I may have gotten the file name wrong; not at my PC right now).

If you see the file and things still aren't working, try copying it into a directory that is in your PATH, e.g., c:\Windows\System32 or similar.

Thanks!
  Torsten
Oct 24, 2012  06:10 PM | Ruben Portugues
RE: Mapping single points under transformations
Hi Torsten,
I reinstalled CMTK-2.2 using the .zip file and it works - the appropriate .dll file now appears in the directory and it all runs smoothly.  Sorry about all the trouble, I am really grateful.
Thank you and all the best,
Ruben
Oct 24, 2012  06:10 PM | Torsten Rohlfing
RE: Mapping single points under transformations
No problem - happy to help.

If you run into similar problems in the future, feel free to create a bug report in the Tracker here on NITRC.

Best,
  Torsten