Question about Elastix Toolbox for Matlab

191 views
Skip to first unread message

Conrad Rockel

unread,
Sep 8, 2017, 12:04:40 PM9/8/17
to gerardu...@googlegroups.com


I am a post-doc at Western University in Ontario, Canada, and I am interested in using your Elastix Toolbox for Matlab.

It strikes me as appealing, since I am doing registration of multiple volumes, and trying to find ways of avoiding the constant manual edits of the parameter text files.  Your code seemed like the answer to my prayers!

Now, I am not too savvy with Github, so I simply copied and pasted several of the *.m files into a directory, and set it up according to the instructions. 

I put together a simple script to replicate a previous rigid registration from command line, and I have already run into an error.

I am using nifti files rather than .mha format, is that a problem?  I have been using the nifti toolbox by Jimmy Shen for a while now.  But I am wondering whether your scripts are expecting this 'scimat' format, of which I'm not familiar.

Also, I am wondering whether I need to download all of Gerardus to get this process going (with proper acknowledgement, of course).

I have attached the testing script I wrote, just in case (switched to a text file to avoid spam traps).  Furthermore, my error message:
 
Undefined function or variable 'scimat_im2scimat'.

Error in elastix>create_temp_file_if_array_image (line 482)
    file = scimat_im2scimat(reshape(file, ...

Error in elastix (line 197)
[fixedfile, delete_fixedfile] = create_temp_file_if_array_image(fixed, '.mha');

Error in RegTST1 (line 45)
[T, MOVINGREG, ITERINFO] = elastix(reggieParam, refVol.img, movVol.img, opts);

 

Any help or advice would be great!  

Conrad

Conrad Rockel, PhD
Postdoctoral Fellow
Dept of Medical Biophysics
Western University
London ON, Canada

RegTST1a.m.txt

Ramón Casero Cañas

unread,
Sep 8, 2017, 12:22:04 PM9/8/17
to Gerardus Users Mailing List
Hi Conrad,

You don't need to, but the simplest way is to clone (download) the whole repository with


Then, you don't need to build the project, just add matlab/ElastixToolbox and matlab/FileFormatToolbox to your Matlab path.

SCIMAT is just a Matlab struct we use to pass images with metainformation, same idea as NIFTI, but different format.

You can create a SCIMAT easily with function


SCIMAT = scimat_im2scimat(IM, RES, OFFSET, ROTMAT)

You just need to extract the image array (IM), pixel size (RES), offset (OFFSET) and rotation matrix (ROTMAT) from the NIFTI struct, which should be easy, and pass them to scimat_im2scimat() (if you don't provide an argument, a default is used instead).

Our elastix() function can take as inputs either a SCIMAT struct, a filename (file in any format that ITK can read), or a plain array (in this case you cannot provide pixel size, offset, etc).

You can read the documentation to elastix() here


The error you get is simply that it cannot find scimat_im2scimat() in your path.

Best regards,

Ramon.



--
You received this message because you are subscribed to the Google Groups "gerardus-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gerardus-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dr Ramón Casero, Post-Doctoral Researcher

 
MRC Harwell Institute, Biocomputing, Mammalian Genetics Unit
Harwell Campus, Oxfordshire, OX11 0RD, UK.
Tel: +44 (0)1235 841237 | www.har.mrc.ac.uk
Reply all
Reply to author
Forward
0 new messages