Glen/James/Marko,

The scaling factor might be the reason for the non-integer values. If you change the scaling factor, then that should solve the problem.

If you are using imcalc, then using FLOAT32 seemingly also solves the problem, but is really a waste of disk space.

Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Postdoctoral Research Fellow, GRECC, Bedford VA
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Website: http://www.martinos.org/~mclaren
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.



On Wed, May 30, 2012 at 12:59 PM, Glen Lee <[log in to unmask]> wrote:
Thanks Jim and Marko.
The script that I wrote was extremely simple (see below) .
If you can see the place where improvement can be made, please let me know.

Best,
Glen,

----------------------------------------

Vol_ROI=spm_vol('~/glen/similarity/broca.img'); %broca.img is the ROI containing
the T-values now I'd like to replace those t-values with 1 to make a good mask


Img_ROI=spm_read_vols(Vol_ROI);
ROI_index=find(Img_ROI);
num_voxels=length(ROI_index);

num_x=size(Img_ROI,1);
num_y=size(Img_ROI,2);
num_z=size(Img_ROI,3);

matrix=zeros(num_x,num_y,num_z);

for x=1:num_x
    for y=1:num_y;
        for z=1:num_z;
           
            if find(Img_ROI(x,y,z))==1
               
                matrix(x,y,z)=1;
               
            end
        end
    end
end

   
   V_mask=Vol_ROI;         
   V_mask.fname = 'Brocas_mask_n35.nii';  %%% Give this a new name
   spm_write_vol(V_mask,matrix);   




On Wed, May 30, 2012 at 11:36 AM, Marko Wilke <[log in to unmask]> wrote:
Jim, Glen,

I actually think that the inverse is true :) If you only want 0 and 1, the lowest-available data precision will do, and everything else is a waste of disk space (and may lead to more errors than it solves). If you need high precision, I would fully agree with Jim's advice, but in this special case, uint8 is plenty.

From what you describe, I think the issue is either in the way you display the images (set interpolation to NN and try again) or in the way you generate the mask: I would suggest using an explicit command to binarize your results, as in (i1.*i2)>0, or by using a round(...) expression or so - I do not know how you generate your mask so hard to comment further on that. Scaling factors in the header might be another nuisance to think of.

Cheers,
Marko


James Lee wrote:
Glen,

I'm not sure this is the answer, but I noticed last year the low
precision of saved spmT maps, and how it influenced their accuracy,
and got the reply from Guillaume below about changing the precision of
the saved maps.

Best!

Jim



SPM Savants,
I often find a smaller minimum value in saved, thresholded spmT maps
than the height threshold displayed on the results page. Has anyone
else noticed this?
The attached text chronicles an experiment on two different runs, in
which half the saved spmT maps include T values less than the height
threshold. These statistics were calculated in SPM8 but I've noticed
the same thing in SPM5.
Many Thanks for your help!
Jim

Here is answer from Guillaume Jan 2011:

Hi Jim,
The thresholded SPM{.} maps are saved as UINT8, ie with a very low
precision, that could explain what you are observing. If it matters to
you, you can change spm_write_filtered.m to save those images using the
same precision as the original SPM{.} maps, ie FLOAT32. To do so, just
change l.44 so that:
  'dt',       [spm_type('float32') spm_platform('bigend')],...
Images will be 4 times bigger on disk though.
I'll make this as default in SPM from now on.
Best regards,
Guillaume.


On 5/30/12, Glen Lee<[log in to unmask]>  wrote:
Hello SPMers--

I've created a mask image where all the significant voxels were assigned
with '1' and others with '0'.
However, after the mask image was created, I found those significant voxels
were assigned with 0.9831, not 1.
I don't know where the particular value came from and I'd like those voxels
within the mask to be '1' to avoid any further confusion.
Is there any way of doing it? Any help would be appreciated.

Glen



--
____________________________________________________
PD Dr. med. Marko Wilke
 Facharzt für Kinder- und Jugendmedizin
 Leiter, Experimentelle Pädiatrische Neurobildgebung
 Universitäts-Kinderklinik
 Abt. III (Neuropädiatrie)


Marko Wilke, MD, PhD
 Pediatrician
 Head, Experimental Pediatric Neuroimaging
 University Children's Hospital
 Dept. III (Pediatric Neurology)


Hoppe-Seyler-Str. 1
 D - 72076 Tübingen, Germany
 Tel. +49 7071 29-83416
 Fax  +49 7071 29-5473
 [log in to unmask]de

 http://www.medizin.uni-tuebingen.de/kinder/epn/
____________________________________________________