quote:
Hi, I would like to get the intensity values at particular coordinates from the raw image (that the datamat is created from) rather than from the datamat itself. In the FAQ it says that: "If you need raw image values, you have to load images by yourself, and extract only the voxels indexed by the XYZmm file you provided".
Could anybody give me a bit more advice about how to do this?
Thanks in advance,
Lucy
Let's say your raw image is:
filename = 'SCAN.img';
or filename = 'SCAN.nii';
and you would like to get the intensity values at particular coordinates from it.
First, you need to load the image by yourself:
nii = load_nii(filename);
Then, display the image:
view_nii(nii);
Since you have already prepared XYZ(mm) in voxel file, you need to switch the selection of "Axes Unit" from "Voxel" to "Millimeter", and then enter each XYZmm value in "[X Y Z] at crosshair" field and click TAB key.
The value displayed in "Value at crosshair" is the intensity value at the particular coordinate you entered.
If you have many coordinates, I suggest that you prepare an XYZ file instead of an XYZ(mm) file, which is also available in the result window. Now, you can use the following simple script to generate the intensity list all at once. Let's say, for example:
xyz = [ 33 44 14;
33 12 8; ];
Here's the simple script:
intensity=[];
for i=1:size(xyz,1)
intensity=[intensity;img.img(xyz(i,1),xyz(i,2),xyz(i,3)];
end