Print

Print


Dear Damien,

A little bit unclear about what you are trying to do but if you just
want to create a binary image with a single non zero voxel, you can use
the following:

  load SPM
  VM = struct(...
      'fname',   'ROI.nii',...
      'dim',SPM.VM.dim,...
      'dt',      [spm_type('float32') spm_platform('bigend')],...
      'mat',     SPM.VM.mat,...
      'pinfo',   [1 0 0]');
  Y = zeros(VM.dim);
  XYZmm = [-54 -22 23];
  XYZ = round(VM.mat\[XYZmm 1]');
  Y(XYZ(1),XYZ(2),XYZ(3)) = 1;
  spm_write_vol(VM,Y);
  spm_summarise('ROI.nii','all','litres') % size of ROI in litres

Best regards,
Guillaume.


On 16/02/17 15:33, Damien MARIE wrote:
> Dear experts,
> 
> I would like to build a ROI of a single voxel using marsbar in the
> framework of a VBM analysis (1.5 mm^3 isotropic voxel size). I tried two
> ways listed below without any success, suggestions would be welcome. I
> could draw it manually but I would like to avoid this if possible and I
> don’t really see how I could manage to get precisely 1.5 mm^3 around my
> coordinates.
> 
> Many thanks,
> Best,
> Damien
> 
> 
> 1) ROi definition > Build > voxel
> Using mm or voxel coordinates, it is not working (see below the error)
> and I suspect this is a bug given that I read threads about that with no
> reply on various lists. Is it working with fMRI data? Could it be
> related to the decimal voxel size?
> 
> 
> Error using maroi_pointlist (line 61)
> Non integer points in voxel space - are points really of type 'mm'?
> 
> Error in mars_build_roi (line 70)
>   o = maroi_pointlist(struct('XYZ', XYZ, 'mat', sp.mat), v);
> 
> Error in marsbar (line 487)
> o = mars_build_roi;
> 
> Error in spm (line 1015)
>     evalin('base',CB)
>  
> Error while evaluating uicontrol Callback
> 
> 
> 
> 2) ROi definition > Build >  Box (center, widths) or (ranges XYZ)
> 
> With Box (center, widths) it is not working when specifying 2 mm of width.
> 
> With Box (ranges XYZ) and using a range of [-1;+1] around each
> coordinate it is working but the resulting ROI is actually 1 x 2 x 2 mm ?!
> 

-- 
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG