Re: [caret-users] nifti images

2006-11-17 Thread Donna Dierker

Hi Mateus,

I think it's worth trying to segment both volumes using Caret to see if 
there is a noticeable effect on surface quality.  My guess is not much, 
but let us know if I'm wrong.


Just make sure you resample to cubic 1mm (preferrably using some 
scriptable utility as part of a preprocessing script that may also 
include bias correction, if needed).


On 11/16/2006 11:07 AM, Mateus Joffily wrote:

Hi Donna,

Usually, I also use SPM for resampling my images. When I resampled the 
3D_resliced.nii image with SPM, the histogram showed the same spiking 
as the original image (3D_original.nii). Only when I resliced the 
image with Caret, the histogram got smooth. I don't know exactly why...


To test the effects of the histogram bin on the final histogram 
distribution, I wrote a small matlab program (see attachment). As you 
can see, depending on the bin size, we can have a spiky histogram 
(top) or a smooth histogram (bottom). Both histograms were calculated 
from the same 3D_resliced.nii image. The spikes occur at bin intervals 
that encloses two successive integer intensity values. In my 
understanding, those spikes should happen whenever we have a discrete 
data set and non-integer bin size. What do you think?


Thanks,
Mateus


Donna Dierker wrote:


Hi Mateus,

See inline replies below.

On 11/14/2006 09:45 AM, Mateus Joffily wrote:


Hi Donna,

Thanks for your help. I am sending you two histograms of 
3D_resliced.nii:
(1) histogram_resliced_1.jpg is the same histogram you already sent 
to me;
(2) histogram_resliced_2.jpg is the histogram of 3D_resliced.nii 
after resampling at 1x1x1mm with Caret.


We can see that the spikes disapear in (2). It looks like much 
closer to the histograms described in your 'Peak Tweaking' document. 
As I don't have much experience with image segmentation, I was 
wondering if there was any problem with my images. I am glad to know 
that they look fine for you.


Try segmenting both inputs using Caret and compare the results.  You 
don't have to patch the resulting hemispheres to get a good feel for 
the quality; just looking at the fiducial surfaces and segmentations 
is generally adequate for judging which input is better, and if the 
differences matter.  An unacceptably blurred structural MRI will have 
a smooth histogram, but probably won't produce a good segmentation.  
In both histograms, I could detect peaks, so there's probably 
adequate GM/WM contrast to get a good segmentation.


May be the problem is the one pointed by Simon. If this is the case, 
adjusting the histogram bins could minimize the effect. Do we have 
control over the histogram bins with Caret interface?


It doesn't look like it; the only inputs are the voxdims.  To be 
honest, I rarely use Caret to resample my volumes.  I usually do this 
as part of a preprocessing protocol using AFNI, FSL, or SPM 
utilities.  They allow one to specify interpolation mode, etc.  (At 
wustl.edu, this is done when the volume is written to 711-2B space 
using Avi Snyder's imgreg and related utilities.)




Thanks,
Mateus



Dierker wrote:


Hi Mateus,

I can't address your original problem with the NIfTI 
orientation/rotation, but I did have a look at your volumes, and 
this statement confuses me:


The histogram of my images (3D_original.nii and 3D_resliced.nii) 
shows several noisy sharp peaks. 



The attached captures show the histograms of 3D_original.nii 
(histogram_orig.jpg) and 3D_resliced.nii (histogram_resliced.jpg).  
The original has smoother looking peaks, but both have discernible 
gray and white matter peaks.  Neither look particularly bothersome.


Could you be more clear about what concerns you?

On 11/13/2006 05:43 AM, Mateus Joffily wrote:


John,

May I profit from the fact that I have already uploaded my images 
to ask you one more question about them? The histogram of my 
images (3D_original.nii and 3D_resliced.nii) shows several noisy 
sharp peaks. Do you know what do they mean? I know that, if I 
reslice the 3D_resliced.nii to 1x1x1mm voxels size with Caret, 
they disappear. Thanks.


Mateus

John Harwell wrote:


Hi Mateus,

Can you upload the nifti volume that is not displayed correctly 
in  Caret at http://pulvinar.wustl.edu/cgi-bin/upload.cgi;.  
Also, can  you capture and upload an image of the volume 
displayed correctly in  SPM5 so that I know how it should appear.


After uploading the files, please email me the names of the 
files.   It may be a few days before I can look into this problem.


--
John Harwell
[EMAIL PROTECTED]
314-362-3467

Department of Anatomy and Neurobiology
Washington University School of Medicine
660 S. Euclid Ave.Box 8108
St. Louis, MO 63110   USA

On Nov 10, 2006, at 9:42 AM, Mateus Joffily wrote:


Hi,

I am having some trouble to load nifti images with caret5. The  
problem is the following:


1) When I try to load an image that has a rotation specified in 
the  header, Caret seems not to 

Re: [caret-users] nifti images

2006-11-17 Thread Mateus Joffily

Hi John,

Thanks. Now, I understand. I thought that the reported dimensions and 
voxel sizes refered to the volume (I,J,K) dimensions (voxel 
coordinates), and not to the (X,Y,Z) dimensions (real world 
coordinates). Please, correct me if I am still wrong?


I have another question: Does Caret take into account any rotation 
specified in the nifti-1 header? Or is there any incompatibility with 
transformations done by SPM5?


To better explain my question, let me describe the following test that I 
did:


1) I rotated my 3D_original.nii image of 45degrees around the X-axis 
(see 3D_original_rotated_spm5.pdf).
2) I saved this rotation in the image header, but I didn't reslice the 
image.
3) When I loaded the rotated image with Caret, I couldn't see anything 
in the P(YZ) and C(XZ) planes. However the H(XY) plane was displayed as 
if the image was not rotated. When I used the 'x', 'y' and 'z' control 
buttons to navigate through the image, the H(XY) slices were displayed 
as if it was the non-rotated 3D_original.nii. The reported dimensions 
and voxel sizes were 124x201x151 and 1.3x1.326x0.00, respectively.


Is it right?

Thanks,
Mateus

John Harwell wrote:


Mateus,

A volume has three-dimensions which are commonly indexed with I, J,  
and K.


When Caret loads a volume it always stores the voxels such that the  
voxels run left-to-right in the first dimension (I), posterior-to- 
anterior in the second dimension (J), and inferior-to-superior  
(K) in the third dimension.  This is commonly referred to as an  
LPI orientation and negative X points to the left side of the head,  
negative Y points to the back of the head, and negative Z points down  
into the neck.  This is the same orientation used by the Talairach  
atlas which places the origin at the anterior commissure.


Your volume has the voxels running anterior-to-posterior in the first  
dimension (I), inferior-to-superior in the second dimension (J),  
and left-to-right in the third dimension(K).  This is an AIL  
orientation.


Since Caret wants the volume in an LPI orientation and your volume is  
in an AIL orientation, Caret will reorganize the voxels in memory so  
that the volume is in an LPI orientation.  It is this reorientation  
operation that results in the voxel sizes and dimensions being permuted.




Output of 3DInfo for your volume and your volume saved by Caret with  
an LPI orientation:



Dataset File:3D_original.nii
Identifier Code: NII_Oo8IAJJUzJFWVH2nBnBIQA  Creation Date: Thu Nov  
16 13:44:28 2006

Dataset Type:Anat Bucket (-abuc)
Byte Order:  LSB_FIRST {assumed} [this CPU native = MSB_FIRST]
Storage Mode:NIFTI file
Data Axes Orientation:
  first  (x) = Anterior-to-Posterior
  second (y) = Inferior-to-Superior
  third  (z) = Left-to-Right   [-orient AIL]
R-to-L extent:   -80.652 [R] -to-79.248 [L] -step- 1.300 mm  
[124 voxels]
A-to-P extent:   -73.912 [A] -to-   113.588 [P] -step- 0.938 mm  
[201 voxels]
I-to-S extent:   -70.210 [I] -to-70.415 [S] -step- 0.938 mm  
[151 voxels]

Number of values stored at each pixel = 1
  -- At sub-brick #0 '?' datum type is float


-

Dataset File:3D_original_saved_with_caret.nii
Identifier Code: NII_Ffg_VXBk3o4b2q-dpSG84g  Creation Date: Thu Nov  
16 13:44:41 2006

Dataset Type:Anat Bucket (-abuc)
Byte Order:  MSB_FIRST {assumed} [this CPU native = MSB_FIRST]
Storage Mode:NIFTI file
Data Axes Orientation:
  first  (x) = Left-to-Right
  second (y) = Posterior-to-Anterior
  third  (z) = Inferior-to-Superior   [-orient LPI]
R-to-L extent:   -80.653 [R] -to-79.248 [L] -step- 1.300 mm  
[124 voxels]
A-to-P extent:   -73.912 [A] -to-   113.588 [P] -step- 0.938 mm  
[201 voxels]
I-to-S extent:   -70.210 [I] -to-70.415 [S] -step- 0.938 mm  
[151 voxels]

Number of values stored at each pixel = 1
  -- At sub-brick #0 '?' datum type is float

--
John Harwell
[EMAIL PROTECTED]
314-362-3467

Department of Anatomy and Neurobiology
Washington University School of Medicine
660 S. Euclid Ave.Box 8108
St. Louis, MO 63110   USA

On Nov 16, 2006, at 11:39 AM, Mateus Joffily wrote:


Hi John,

Although the image orientation is fine and the origin is correctly  
localized at the AC, it still seems to have some problem with the  
image dimension and voxel size.


The correct image dimension and voxel size are 201 x 151 x 124 and  
-0.938 x 0.938 x 1.3 (X x Y x Z), respectively (see the  
3D_original_spm5.pdf file that I uploaded).  However, the values  
reported by Caret are 124 x 201 x 151 and 1.3 x 0.938 x 0.938.


Thanks for your help,
Mateus


John Harwell wrote:


Mateus,

To download updated versions of Caret:

1) Go to the website http://brainmap.wustl.edu/pub/john/;.  Use  
the  username pub and the password download to access the web  
site.
2) Download the file caret5_exe_linux.zip or  
caret5_exe_windows.zip  which contain the linux and windows