users > Registration of 32-bit stacks
Showing 1-17 of 17 posts
Display:
Results per page:
Jul 31, 2020  10:07 AM | Francesco Vanzi
Registration of 32-bit stacks
Hi,
is it possible to handle 32-bit image stacks in CMTK?
I have attempted a registration but it failed.
Thanks!
Francesco
Jul 31, 2020  10:07 AM | Greg Jefferis
RE: Registration of 32-bit stacks
Yes should be fine. Are you sure it is correctly saved? float or integer? Greyscale or label data? Of course it is possible that you could be close to the memory threshold of your machine. Do you get any error message?

Originally posted by Francesco Vanzi:
Hi,
is it possible to handle 32-bit image stacks in CMTK?
I have attempted a registration but it failed.
Thanks!
Francesco
Jul 31, 2020  11:07 AM | Francesco Vanzi
RE: Registration of 32-bit stacks
Hi Greg,
thanks for your quick reply!!!
The data is float greyscale. This is the shell:

C:\CMTK_Registration\CMTKreg>perl C:\CMTK_Registration\CMTK\bin\munger -b C:\CMTK_Registration\CMTK\bin -a -w -r 01 -T8 -X52 -C8 -G80 -R3 -A "--accuracy 0.4" -W "--accuracy 1.6" -s template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images
hostname = Francesco-HP; short hostname = Francesco-HP
JOB ID =
Root directory is C:\CMTK_Registration\CMTKreg
Changing to root directory: C:\CMTK_Registration\CMTKreg
Setting image root to: images
MYEXEC: CMD = md Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list exited with value 0
Aff:MIP318zf01 INFO: number of threads set to 8 according to environment variable CMTK_NUM_THREADS
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.
MYEXEC: CMD = C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd exited with value 255
Aff:MIP318zf01 INFO: number of threads set to 8 according to environment variable CMTK_NUM_THREADS
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.
MYEXEC: CMD = C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd exited with value 255

Ran 0 initial affine registrations of which 0 failed
Ran 2 affine registrations of which 2 failed
Ran 0 warp registrations
Reformatted 0 images
Originally posted by Greg Jefferis:
Yes should be fine. Are you sure it is correctly saved? float or integer? Greyscale or label data? Of course it is possible that you could be close to the memory threshold of your machine. Do you get any error message?

Originally posted by Francesco Vanzi:
Hi,
is it possible to handle 32-bit image stacks in CMTK?
I have attempted a registration but it failed.
Thanks!
Francesco
Jul 31, 2020  11:07 AM | Greg Jefferis
RE: Registration of 32-bit stacks
Can you run one of the individual registrations to get more info about the error. e.g.

cd C:\CMTK_Registration\CMTKreg

C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd

Jul 31, 2020  12:07 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
Originally posted by Greg Jefferis:
Can you run one of the individual registrations to get more info about the error. e.g.

cd C:\CMTK_Registration\CMTKreg

C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd


I ran the command but there was no visible outcome

C:\CMTK_Registration\CMTKreg>C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.
Jul 31, 2020  01:07 PM | Greg Jefferis
RE: Registration of 32-bit stacks
Strange. Maybe try changing one or both images back to 16 or 8 bit and see if you are able to start things? In general I can't see a strong reason for using anything above 16 bit. Best, Greg,
Originally posted by Francesco Vanzi:
Originally posted by Greg Jefferis:
Can you run one of the individual registrations to get more info about the error. e.g.

cd C:\CMTK_Registration\CMTKreg

C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd


I ran the command but there was no visible outcome

C:\CMTK_Registration\CMTKreg>C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.
Jul 31, 2020  01:07 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
The reason I am trying this might be due to a very naive approach to the following problem:

I have a stack resulting from segmentation of my imaging original stack. The segmented data give me the neuron id number in each pixel occupied by that neuron. I want to register this segmented data to a reference brain. So, what I do is this:
1) I register the original greyscale stack to the reference brain
2) I use the xform file obtained in step 1 to register the segmented stack with neuron label numbers to the reference brain so I can read each neuron number directly in a referenced anatomical area. (In a previous post you helped me to solve the problem of registering labels rather than greyscale values by using the -pv option in reformatx)

Since neurons numbers exceed 65536 I need to go higher than 16 bit in the segmented stack.

Thanks for your help!

Francesco


Originally posted by Greg Jefferis:
Strange. Maybe try changing one or both images back to 16 or 8 bit and see if you are able to start things? In general I can't see a strong reason for using anything above 16 bit. Best, Greg,
Originally posted by Francesco Vanzi:
Originally posted by Greg Jefferis:
Can you run one of the individual registrations to get more info about the error. e.g.

cd C:\CMTK_Registration\CMTKreg

C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd


I ran the command but there was no visible outcome

C:\CMTK_Registration\CMTKreg>C:\CMTK_Registration\CMTK\bin\registration -i -v --dofs 6 --dofs 9 --accuracy 0.4 -o Registration\affine\Ref20131120pt14pl2_MIP318zf01_9dof.list template/Ref20131120pt14pl2_Randlett_stackrev_01.nrrd images/MIP318zf01.nrrd
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.
Aug 1, 2020  11:08 AM | Greg Jefferis
RE: Registration of 32-bit stacks
Hi Francesco,

I don't think you want to do what you are trying to do. Specifically I don't see why you want to "register" the label field. Please note that in the parlance of CMTK and similar tools "register" means calculate the transform between two spaces *not* apply the transform to image data.

Once you have calculated a registration between sample and template greyscale stacks (using munger or directly using cmtk registration and cmtk warp) you will only need to use reformatx to convert your sample space label field into a template space label field.

For example

reformatx --outputtype "uint" --pv --floating -o

should do what you need. I am not sure if you need the output type argument but it shouldn't hurt.

Best,

Greg.
Aug 1, 2020  02:08 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
Originally posted by Greg Jefferis:
...

Once you have calculated a registration between sample and template greyscale stacks (using munger or directly using cmtk registration and cmtk warp) you will only need to use reformatx to convert your sample space label field into a template space label field.

For example

reformatx --outputtype "uint" --pv --floating -o

should do what you need. I am not sure if you need the output type argument but it shouldn't hurt.

Best,

Greg.




Hi Greg,
thanks for your reply!!

Yes, that's exactly what I am trying to do! Sorry for the improper terms.
I tried the command you suggested but it produces no output.It runs with no error but the output file is not created.


Maybe I make a mistake in getting the xform file: I get it from the Registration\warp\..\registration.gz
I unzip the gz file and add the .xform extension.
When I use this for reformatting the sample image it works, but maybe it's not the right thing to do.
I am sorry to bother you with all these questions, I am just starting to enter the field, as you can tell!
So, thank you really a lot for all your help!!

Francesco
Aug 1, 2020  03:08 PM | Greg Jefferis
RE: Registration of 32-bit stacks
Dear Francesco,

I'm sorry it looks like the nitrc web interface mangled the command. It should have been this:

reformatx --outputtype "uint" --pv --floating -o

In terms of the output of the previous registration, the normal approach is to point to the .list folder one level below your warp folder. You do not need to gunzip anything.

All the best,

Greg.

Aug 1, 2020  03:08 PM | Greg Jefferis
RE: Registration of 32-bit stacks
(Not just the web interface it seems, try this, appropriately edited)

reformatx --outputtype "uint" --pv --floating mylabels.nrrd -o template_labels.nrrd template.nrrd registration.list


Aug 1, 2020  05:08 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
Still not working.

Does it matter if the registration was done on 16bit template and sample?

I mean, is it ok if I have my greyscale stack (16 bit), I register that onto a template (16 bit) and then I reformat my labels (32 bit) with the transformation obtained in the registration of those two?

Also, another question to try to better understand the process: my understanding is that the .list folder contains the matrix/ces necessary to reformat the sample into the template space, correct? When I apply this matrix to my labels I should transform them into the template space as well. Why is the template stack needed in the reformat routine?

Thanks!!!!!!

Francesco
Aug 1, 2020  05:08 PM | Greg Jefferis
RE: Registration of 32-bit stacks
Can you show your command and all the output? You can include the -v (verbose) switch 

reformatx -v --outputtype "uint" --pv --floating mylabels.nrrd -o template_labels.nrrd template.nrrd registration.list

to produce additional output.
Originally posted by Francesco Vanzi:
Does it matter if the registration was done on 16bit template and sample?

No it does not matter.

I mean, is it ok if I have my greyscale stack (16 bit), I register that onto a template (16 bit) and then I reformat my labels (32 bit) with the transformation obtained in the registration of those two?

Yes that is fine.
Also, another question to try to better understand the process: my understanding is that the .list folder contains the matrix/ces necessary to reformat the sample into the template space, correct? When I apply this matrix to my labels I should transform them into the template space as well. Why is the template stack needed in the reformat routine?

Yes, your understanding is correct. The template image is needed at this step *only* to specify the dimensions of the new output image, not the transform. It is actually possible to specify these dimensions on the command line, but we recommend doing it this way.
Aug 1, 2020  07:08 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
C:\CMTK_Registration\CMTKreg>C:\CMTK_Registration\CMTK\bin\reformatx -v --outputtype "uint" --pv -o mylabels2.nrrd --floating C:\CMTK_Registration\CMTKreg\images\Stack_celllabel32b_01.nrrd C:\CMTK_Registration\CMTKreg\template\Ref20131120pt14pl2_Randlett_stackrev_01.nrrd C:\CMTK_Registration\CMTKreg\results\Registration_318_vs_template\Registration\warp\Ref20131120pt14pl2_MIP318zf01_warp_m0g80c8e1e-1x52r3.list
Reading transformation from studylist C:\CMTK_Registration\CMTKreg\results\Registration_318_vs_template\Registration\warp\Ref20131120pt14pl2_MIP318zf01_warp_m0g80c8e1e-1x52r3.list
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.

C:\CMTK_Registration\CMTKreg>




This is what I get. The file mylabels2.nrrd is not created

Francesco
Aug 1, 2020  07:08 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
If, on the other hand, I use a 16bit stack as floating image it works:

C:\CMTK_Registration\CMTKreg>C:\CMTK_Registration\CMTK\bin\reformatx -v --outputtype "ushort" --pv -o mylabels2.nrrd --floating C:\CMTK_Registration\CMTKreg\images\Stack_celllabels01.nrrd C:\CMTK_Registration\CMTKreg\template\Ref20131120pt14pl2_Randlett_stackrev_01.nrrd C:\CMTK_Registration\CMTKreg\results\Registration_318_vs_template\Registration\warp\Ref20131120pt14pl2_MIP318zf01_warp_m0g80c8e1e-1x52r3.list
Reading transformation from studylist C:\CMTK_Registration\CMTKreg\results\Registration_318_vs_template\Registration\warp\Ref20131120pt14pl2_MIP318zf01_warp_m0g80c8e1e-1x52r3.list
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: image does not have valid orientation meta information; cannot reorient.
WARNING: trying to change image coordinate space, but no current space is defined. Coordinate system of the resulting image is very likely incorrect.



If, on the other hand, I change to outputtype "uint" leaving everything else the same it does not work.
Aug 1, 2020  07:08 PM | Greg Jefferis
RE: Registration of 32-bit stacks
Hmm. Maybe you had better share sample files with me off list.

Aug 7, 2020  09:08 PM | Francesco Vanzi
RE: Registration of 32-bit stacks
Thanks to Greg's suggestions the problem is solved!

I switched from the windows cmtk installation with active perl to cygwin.
For installation I followed the instructions reported in
http://natverse.org/nat/articles/Install...

Running cmtk in cygwin reformatted my 32 bit stacks with this line command:
cmtk reformatx -v --uint --pv -o outputfilename.nrrd --floating floatingimage.nrrd templateimage.nrrd Registration/warp/registrationfolder.list

Francesco