users > File format and registration problem
Showing 1-20 of 20 posts
Display:
Results per page:
Mar 23, 2011  04:03 PM | Thomas Templier
File format and registration problem
Hello,

I'm doing my first steps with CMTK and have several problems.

File format :

-- I'm using .tif files of confocal images. Some have one channel, and some have several channels (image[0:100] red channel, and image[101:200] green channel for example). The only converter tool I've found that can convert a .tif in a file read by CMTK is ImageJ that converts a .tif in a .nrrd file. Is it a good solution ?

Registration : I've tried to use the affine and the nonrigid registration implemented in CMTK with my two .nrrd files.

-- when I use like in the tutorial
registration --initxlate --dofs 6,9 --auto-multi-level 4 -o affine.xform ref.nrrd flt.nrrd
   I have the following :
WARNING : the following command line arguments were not used: --auto-öulti-level 4 -o affine.xform ref.nrrd flt.nrrd
Unknown option: --auto-multi-level [argument#0]
-- if I use
warp -o ffd40.xform --grid-spacing 40 --initial affine.xform ref.nii flt.nii
then I have
The file/directory affine.xform does not seem to be in a supported transformation format

So thank you for your help. I hope there are not too stupid questions, otherwise feel free to indicate me some tutorials I've missed.



Thomas
Mar 23, 2011  06:03 PM | Torsten Rohlfing
RE: File format and registration problem
Hi Thomas:

You know of course there are no stupid question - just stupid answers ;)

Since you're asking about tiff and multiple color channels, let me start by pointing out that CMTK cannot handle 2D data, only 3D, and it cannot handle vector-valued data, such as RGB. Just to get these two out of the way.

I usually use the ConvertBetweenImageFormats tool from ITK's companion "InsightApplications" to convert file formats, but ImageJ should work at least as well.

Now for your specific problems:

a) unfortunately you found a typo in the CMTK User Guide - the registration tool has an option "--auto-multi-levels", not "--auto-multi-level" as it says in the guide. I will fix that in the next revision. Simply change your command line by adding the missing "s" and things should work.

As a general suggestion - all tools in CMTK support the "--help" option, which will print a list of all supported command line options for that particular tool.

b) the problem you have with "warp" is probably related to the fact that the preceding "registration" command failed and did not actually generate any output file at all. What's a bit curious, though is that the error message for a non-existing input transformation should say that it doesn't exist, not that it is in an unsupported format. If the problem persists after fixing the "registration" command, feel free to send me the "affine.xform" contents (this is most likely a directory) and I'll take a closer look.

Best,
 Torsten
Originally posted by Thomas Templier:
Hello,

I'm doing my first steps with CMTK and have several problems.

File format :

-- I'm using .tif files of confocal images. Some have one channel, and some have several channels (image[0:100] red channel, and image[101:200] green channel for example). The only converter tool I've found that can convert a .tif in a file read by CMTK is ImageJ that converts a .tif in a .nrrd file. Is it a good solution ?

Registration : I've tried to use the affine and the nonrigid registration implemented in CMTK with my two .nrrd files.

-- when I use like in the tutorial
registration --initxlate --dofs 6,9 --auto-multi-level 4 -o affine.xform ref.nrrd flt.nrrd
   I have the following :
WARNING : the following command line arguments were not used: --auto-öulti-level 4 -o affine.xform ref.nrrd flt.nrrd
Unknown option: --auto-multi-level [argument#0]
-- if I use
warp -o ffd40.xform --grid-spacing 40 --initial affine.xform ref.nii flt.nii
then I have
The file/directory affine.xform does not seem to be in a supported transformation format

So thank you for your help. I hope there are not too stupid questions, otherwise feel free to indicate me some tutorials I've missed.



Thomas
Mar 23, 2011  08:03 PM | Torsten Rohlfing
RE: File format and registration problem
P.S.: I just uploaded a corrected and somewhat extended version of the User Guide to NITRC and the Insight Journal (same document through both portals).
Mar 24, 2011  02:03 PM | Thomas Templier
RE: File format and registration problem
Dear Torsten,

thank you for your quick answer. I still have a problem :

I'm now using the command
registration --initxlate --dofs 6,9 --auto-multi-levels 4 -o affine.xform ref.nrrd flt.nrrd
where ref.nrrd and flt.nrrd are 3D confocal image stacks that have been converted with ImageJ from ref.tif and flt.tif. I get :

WARNING: image does not have valid orientation meta information;cannot reorient.
WARNING: image does not have valid orientation meta information;cannot reorient.
Multi-level Registration: 100%
ref.tif and flt.tif are 16-bit images. I don't get any affine.xform file.

I'm trying to use ConvertBetweenFileFormats tool from ITK's companion "InsightApplications", but for the moment I've some problems to handle it. (my helloworld does not work) Should I try an other format than nrrd ? The tif converter from ImageJ is the only one I've found that can export in a file readable from CMTK.

Has somebody an idea ?

Thank you

Thomas




Originally posted by Torsten Rohlfing:
Hi Thomas:

You know of course there are no stupid question - just stupid answers ;)

Since you're asking about tiff and multiple color channels, let me start by pointing out that CMTK cannot handle 2D data, only 3D, and it cannot handle vector-valued data, such as RGB. Just to get these two out of the way.

I usually use the ConvertBetweenImageFormats tool from ITK's companion "InsightApplications" to convert file formats, but ImageJ should work at least as well.

Now for your specific problems:

a) unfortunately you found a typo in the CMTK User Guide - the registration tool has an option "--auto-multi-levels", not "--auto-multi-level" as it says in the guide. I will fix that in the next revision. Simply change your command line by adding the missing "s" and things should work.

As a general suggestion - all tools in CMTK support the "--help" option, which will print a list of all supported command line options for that particular tool.

b) the problem you have with "warp" is probably related to the fact that the preceding "registration" command failed and did not actually generate any output file at all. What's a bit curious, though is that the error message for a non-existing input transformation should say that it doesn't exist, not that it is in an unsupported format. If the problem persists after fixing the "registration" command, feel free to send me the "affine.xform" contents (this is most likely a directory) and I'll take a closer look.

Best,
 Torsten
Originally posted by Thomas Templier:
Hello,

I'm doing my first steps with CMTK and have several problems.

File format :

-- I'm using .tif files of confocal images. Some have one channel, and some have several channels (image[0:100] red channel, and image[101:200] green channel for example). The only converter tool I've found that can convert a .tif in a file read by CMTK is ImageJ that converts a .tif in a .nrrd file. Is it a good solution ?

Registration : I've tried to use the affine and the nonrigid registration implemented in CMTK with my two .nrrd files.

-- when I use like in the tutorial
registration --initxlate --dofs 6,9 --auto-multi-level 4 -o affine.xform ref.nrrd flt.nrrd
   I have the following :
WARNING : the following command line arguments were not used: --auto-öulti-level 4 -o affine.xform ref.nrrd flt.nrrd
Unknown option: --auto-multi-level [argument#0]
-- if I use
warp -o ffd40.xform --grid-spacing 40 --initial affine.xform ref.nii flt.nii
then I have
The file/directory affine.xform does not seem to be in a supported transformation format

So thank you for your help. I hope there are not too stupid questions, otherwise feel free to indicate me some tutorials I've missed.



Thomas
Mar 24, 2011  03:03 PM | Greg Jefferis
RE: File format and registration problem
Hi Thomas,

Fiji / ImageJ is probably the best way to go for converting confocal
images. You can use either nifti (nii) or nrrd format. I personally
would recommend nrrd format - I like the human readable header.

You must make sure that your images include calibration information.
They may well loose this if you are opening generic tif files with
ImageJ. You are better off using ImageJ to open your manufacturer's
confocal image format directly (eg leica lei/tif or zeiss lsm) without
trying to export from the confocal software as tif. Fiji comes with
appropriate plugins to read most proprietary confocal formats. There
are also plenty of ImageJ batch conversion macros available that you can
modify to convert a directory of eg lsm files to nrrd.

The warning that you have seen is harmless - it means that your nrrd
files do not include a definition of an anatomically-based coordinate
system (which hasn't yet been standardised for fruit flies anyway!).

As for why you are not getting any output, I'm not entirely sure, but
you should check that you can reopen your images with Fiji and that they
have sensible properties (eg voxel size).

Finally, if you want to find out more about parameters that we have used
for confocal images, see:

http://flybrain.mrc-lmb.cam.ac.uk/dokuwi...

and especially:

http://flybrain.mrc-lmb.cam.ac.uk/dokuwi...

Best wishes from Cambridge,

Greg Jefferis

PS If you are going to work with nrrd format images and are comfortable
with the command line, I also recommend installing the "unu" tool
available as part of the teem project (google: teem unu)

Mar 24, 2011  03:03 PM | Torsten Rohlfing
RE: File format and registration problem
Hi Thomas:

As Greg already said, the warnings you are seeing are harmless. CMTK tries to reorient all images into "Right-Anterior-Superior" human anatomical orientation, but clearly that isn't possible for non-human images, in which case the images are simply left as they are. So long as your images are oriented approximately the same way (ie., same slice stacking direction) there should be no problem. Otherwise you would have to provide an initial transformation for gross orientation.

Regarding affine.xform - you say you don't get that file. Actually, you should be getting a directory of that name. If you don't, try adding "-v" to the command line; see if that gives you more information.

Best,
  Torsten
Originally posted by Thomas Templier:
Dear Torsten,

thank you for your quick answer. I still have a problem :

I'm now using the command
registration --initxlate --dofs 6,9 --auto-multi-levels 4 -o affine.xform ref.nrrd flt.nrrd
where ref.nrrd and flt.nrrd are 3D confocal image stacks that have been converted with ImageJ from ref.tif and flt.tif. I get :

WARNING: image does not have valid orientation meta information;cannot reorient.
WARNING: image does not have valid orientation meta information;cannot reorient.
Multi-level Registration: 100%
ref.tif and flt.tif are 16-bit images. I don't get any affine.xform file.
Mar 25, 2011  12:03 PM | Thomas Templier
RE: File format and registration problem
Thank you Torsten and Greg.
When I reopen the .nrrd file with Fiji and check the properties I have this :

NRRD0004
# Created by Nrrd_Writer at Wed Mar 23 16:50:58 CET 2011
type: uint16
encoding: raw
endian: big
dimension: 3
sizes: 1024 640 119
space dimension: 3
space directions: (0.013888888888888888,0,0) (0,0.013888888888888888,0) (0,0,1.0)
space units: "cm" "cm" "cm"
------------------------
Title: flt.nrrd
Width: 14.22 cm (1024)
Height: 8.89 cm (640)
Depth: 119.00 cm (119)
Resolution: 72 pixels per cm
Voxel size: 0.01x0.01x1 cm
ID: -2
Coordinate origin: 0,0,0
Bits per pixel: 16 (unsigned)
Display range: 88 - 467
Image: 1/119
No Threshold
Uncalibrated
Path: P:\FirstConfoca1403l\flt.nrrd
No Selection

So I don't know exactly what you meant with "sensible properties" (voxel size), but it seems to be defined.
Using the command with -v like Torsten proposed, I have roughly :

... ref.nrrd
Read 1024x512x102 voxels [14.208333 x 7.091222 x 101.0000 mm total size].
Date type ushort <16bit unsigne>, range [61 .. 4095]
WARNING: image does not have valid orientation meta information;cannot reorient.
Read 1024x640x119 voxels [14.208333 x 8.875 x 118.0000 mm total size].
Date type ushort <16bit unsigne>, range [83 .. 4095]
WARNING: image does not have valid orientation meta information;cannot reorient.
Entering resolution level 1 out of 5...
Entering resolution level 1 out of 5...
Entering resolution level 2 out of 5...
Entering resolution level 2 out of 5...
Entering resolution level 3 out of 5...
Entering resolution level 3 out of 5...
Entering resolution level 4 out of 5...
Entering resolution level 4 out of 5...
Entering resolution level 5 out of 5...
Entering resolution level 5 out of 5...
Resulting transformation parameters:
#0: 0.0
#1: -0.88889
#2: -8.5
#3:-0
#4:-0
#5:-0
#6:1.0
#7:1.0
#8:.10
#9:0.0
#10:0.0
#11:0.0
#12:7.104
#13:4.4375
#14: 59
#

And I have no affine.xform file or directory anywhere. (it should be in the same directory as where registration.exe is or in the directory of my images ? I also tried
-o C:\Users\templier\Desktop\affine.xform
and nothing appears)

(By the way, I struggle to have this output automatically in an output file of in my clipboard and it does not work, using different windows command :
registration --initxlate --dofs 6,9 --auto-multi-levels 4 -v -o affine.xform C:\CMTK_TEST\ref.nrrd C:\CMTK_TEST\flt.nrrd > C:\Users\templier\Desktop\dir.txt
registration --initxlate --dofs 6,9 --auto-multi-levels 4 -v -o affine.xform C:\CMTK_TEST\ref.nrrd C:\CMTK_TEST\flt.nrrd | clip )
I also noticed that after one or two computations (I run it first, then a bit later the same task) the program crashes : windows says "registration.exe has stopped working" and in the command line I have

... ref.nrrd

Read 1024x512x102 voxels [14.208333 x 7.091222 x 101.0000 mm total size].

Date type ushort <16bit unsigne>, range [61 .. 4095]

WARNING: image does not have valid orientation meta information;cannot reorient.Read 1024x640x119 voxels [14.208333 x 8.875 x 118.0000 mm total size].


Date type ushort <16bit unsigne>, range [83 .. 4095]


WARNING: image does not have valid orientation meta information;cannot reorient.

Entering resolution level 1 out of 5...
Multi-level R

For my next scans, I´ll use the format directly given by my microscope (olympus > oib), and see what it gives.

Greg, I'll take a closer look at what you have done for fly brains registration, that's what I would like to do.#

Thank you for your help

Thomas

Mar 25, 2011  12:03 PM | Greg Jefferis
RE: File format and registration problem
Hi Thomas,

Your voxel sizes are not sensible and this is not going to help things.
In particular dx=dy ~= 0.013 cm while dz=1 cm ie ~ 77 deeper in Z than
wide in XY, the correct ratio is probably between 2 and 4. This means
that your brains are massively elongated in Z. You need to open the raw
confocal files (not exported tifs) in Fiji in order to get the correct
voxel sizes. If you cannot do this then use Fiji to set the Properties
for your tif files before saving to nrrd.

Regarding the lack of output file, I cannot really see what could be
wrong although I have no experience of CMTK on windows.

Best,

Greg.

Mar 25, 2011  06:03 PM | Torsten Rohlfing
RE: File format and registration problem
Thomas:

What version of CMTK are you using?

Torsten
Mar 25, 2011  11:03 PM | Torsten Rohlfing
RE: File format and registration problem
Thomas:

Not sure whether you are using a pre-compiled version of CMTK or building your own.

In the latter case, you may want to try the latest SVN/trunk version - it fixes a problem caused by the difference in path separator characters between Unix and Windows (i.e., "/" vs "\"). This should fix the problem of not getting the registration output written to disk.

At the same time, I cannot currently get the registration tool to work on my test system at all. There appears to be some additional trouble which leads to a crash before registration even starts. This issue appea4red some time after release 1.2.2, i.e., quite a while back (seems no one was actually using the Windows builds that I kept making). I am currently tracking this down but will have to come back to it after the weekend.

Best,
  Torsten
Mar 27, 2011  02:03 PM | Thomas Templier
RE: File format and registration problem
Hello Torsten,

I downloaded 1.6.1:CMTK 1.6.1-Windows-x86-VS2010.exe (18 M) from the main website http://www.nitrc.org/projects/cmtk/. I've just run the .exe file and then it was installed if I well remember.
I changed the voxel size of my images with Fiji, as Greg told me, and tried to use the registration tool of CMTK. Now it always crashes. (before it did not crash sometimes). 
So before using the windows version, I should wait for the problem to be solved. (or use the latest SVN/trunk version, but I'm quite new no the developing and open-source world, and I'm not familiar with SVN for the moment, but it will come)


(let me know if I should edit this part and put it in a new topic)
By the way, I'm trying to run it on my personal laptop with linux 64 bit. I've downloaded 1.6.1:CMTK 1.6.1-Linux-x86_64.tar.gz, and then extracted it :
tar -xzvf CMTK-1.6.1-Linux-x86_64.tar.gz
Then I'm a bit confused. It is a prebuilt binary, but I should first compile it with cmake right ? However, there is no CMakeLists.txt. There are just some .cmake files, that can be used for external projects (that is, if I want to use CMTK in another program ?). So I should create the CMakeLists.txt myself ? In this case I should create these files also in each subdirectory ? (it would lead to more than 10 CMakeLists.txt files which seems to be a lot) I've read some tutorials on cmake, and I'm not against learning but I feel a bit lost for the moment. Could someone guide me a bit ?

Thank you for your help

Best Regards,

Thomas
Mar 27, 2011  05:03 PM | Torsten Rohlfing
RE: File format and registration problem
Hi Thomas:

If you want an immediate fix for your Windows system, you may want to consider using the Cygwin binaries for now. You would have to install Cygwin itself also (from http://www.cygwin.com) but after that all the binaries should work as if they were native Windows executables.

The Linux archive you downloaded is indeed pre-compiled and should be ready to run. No compilation or configuration required, thus there is no CMakeLists.txt file. In general, you should not need cmake (now there's some good news at last) or any compiler tools to use these. The only limitation is that you may run into problems with system library versions - we are using fairly recent Linux versions here (Fedora 13 and 14), and I have yet to find a way to build binaries that work with older versions of standard C and C++ libraries.

Best,
  Torsten
Originally posted by Thomas Templier:
Hello Torsten,

I downloaded 1.6.1:CMTK 1.6.1-Windows-x86-VS2010.exe (18 M) from the main website http://www.nitrc.org/projects/cmtk/. I've just run the .exe file and then it was installed if I well remember.
I changed the voxel size of my images with Fiji, as Greg told me, and tried to use the registration tool of CMTK. Now it always crashes. (before it did not crash sometimes). 
So before using the windows version, I should wait for the problem to be solved. (or use the latest SVN/trunk version, but I'm quite new no the developing and open-source world, and I'm not familiar with SVN for the moment, but it will come)


(let me know if I should edit this part and put it in a new topic)
By the way, I'm trying to run it on my personal laptop with linux 64 bit. I've downloaded 1.6.1:CMTK 1.6.1-Linux-x86_64.tar.gz, and then extracted it :
tar -xzvf CMTK-1.6.1-Linux-x86_64.tar.gz
Then I'm a bit confused. It is a prebuilt binary, but I should first compile it with cmake right ? However, there is no CMakeLists.txt. There are just some .cmake files, that can be used for external projects (that is, if I want to use CMTK in another program ?). So I should create the CMakeLists.txt myself ? In this case I should create these files also in each subdirectory ? (it would lead to more than 10 CMakeLists.txt files which seems to be a lot) I've read some tutorials on cmake, and I'm not against learning but I feel a bit lost for the moment. Could someone guide me a bit ?

Thank you for your help

Best Regards,

Thomas
Mar 28, 2011  08:03 PM | Torsten Rohlfing
RE: File format and registration problem
Thomas:

I believe I fixed the problems of missing output files and crashing tools on Windows. I uploaded pre-1.7.0 release binaries for Windows only, which you can get from the CMTK Downloads area. Let me know if these work for you.

Best,
  Torsten
Mar 30, 2011  02:03 PM | Thomas Templier
RE: File format and registration problem
Hi Torsten,

sorry I could not test earlier than that. The new release in windows works for me ! (the program works, yes, but the transformation for the affine registration is completely wrong, but it is a different story, I'll take a closer look to what has been done with drosophila)

I tried to run CMTK also on Ubuntu 9.10, 10.04 and 10.10 and it does not work (I don't remember the name of the library, I could edit it). One day I'll try to use fedora as you mentioned.

Thank you for the great support

Best Regards

Thomas
Mar 30, 2011  05:03 PM | Torsten Rohlfing
RE: File format and registration problem
Thomas:

Glad to know we're making progress. There are some remaining problems in the test binaries you used, which I also fixed, so the final release should be better yet.

Regarding correctness of the transformations - how did you determine the affine registrations were wrong? Did you reformat the moving image and compare with the fixed image? If so, are you sure you used the correct reformat command? Of course things do go wrong (all the time), so I wouldn't be surprised, but just curious...

Best,
  Torsten
Apr 4, 2011  11:04 AM | Thomas Templier
RE: File format and registration problem
Hello Torsten,

I tested it with two raw datas of confocal images of whole fly brains. Fly brains were stained with phaloidine rodamine.

I've used the command

registration --initxlate --dofs 6,9 --auto-multi-levels 4 -v -o affine.xform C:\CMTK_TEST\Test\ref.nrrd C:\CMTK_TEST\Test\flt.nrrd
Then, to see the result I've used

reformatx -o reformat.nrrd --floating flt.nrrd ref.nrrd affine.xform
The resulting reformat.nrrd is shifted on the top, as if the transformation was a translation in direction of the top (with amplitude = half of the image height). That is why I say it failed.

With an other image pair, the translation is extreme on the left, and a very little part of the image can be seen.

Maybe I missed some preprocessing steps. Let me know if you need some more information.

Best Regards,

Thomas
Apr 4, 2011  05:04 PM | Torsten Rohlfing
RE: File format and registration problem
Hi Thomas -

No, your command lines look fine to me. Have you looked into the potential pixel size issue that Greg pointed out a while back?

If so, maybe the fastest way to get your problem fixed is if you could send me your test images so I can take a look myself.

Do you have a server where you could put them? Otherwise I can send you information where to upload your files.

Best,
  Torsten
Apr 4, 2011  05:04 PM | Thomas Templier
RE: File format and registration problem
Yes I fixed the problem of the pixel size.

I've now tried with other samples, and it seemed to work better. (with another staining : topro-3) (just one trial)

I'm quite new in my lab and don't know if I can upload somewhere. So the more convenient would be that you give me a way to upload. 

Thanks for the support

Best Regard,

Thomas

(I'll be away one week, so I may upload only next week)
May 4, 2011  09:05 AM | Thomas Templier
RE: File format and registration problem
Hello ,

I tried to register on your web page (http://flybrain.mrc-lmb.cam.ac.uk/dokuwi...) but I did not receive any registration confirmation per email. Is it normal ? I'd like to take a look at the registration tools you used (IGS).

One month ago I explained on this thread that I had problems with some registration of fly brains and Thorsten proposed me to take a look at my files. I realized later that that the orientations of the brains were ventral->dorsal and dorsal>ventral. It must be the reason why it had failed. I'll try with a reorientation first.

Thank you

Best Regards,

Thomas
May 4, 2011  10:05 AM | Greg Jefferis
RE: File format and registration problem
Hi Thomas,

That wiki page:

http://flybrain.mrc-lmb.cam.ac.uk/dokuwi...

contains some details about how my lab have been using the registration
software. All of that information is visible without logging in to the
wiki, which also contains other information specific to my lab (which
requires a login).

The site:

flybrain.stanford.edu

(which does require user registration) contains much older versions of
Torsten's registration software bundled with a very basic GUI for macosx.

Best,

Greg Jefferis.