Matlab Help Index Technical Documentation Index

compactROI

NAME ^

compactROI -- converts a sparse ROI matrix into a list of voxel coordinates

SYNOPSIS ^

function roimtx = compactROI(ROI)

DESCRIPTION ^

 compactROI -- converts a sparse ROI matrix into a list of voxel coordinates
 
 Since ROIs are quite sparse when represented as [nSlices nRows nColumns], it
 is more space- and time-efficient to store the data as a simple list of
 voxel coordinates, with an optional additional value of some significance
 for each voxel.  compactROI does such a thing, returning a matrix of size
 [num_voxels_in_roi 4], where the four columns correspond to slice number,
 row, column, value at the voxel.  Note that there is some row-/column-major
 trickery that goes on in FS-FAST; look at the source code in FSFAST::ROI for
 details.

 roimtx = compactROI(ROI), where ROI is a 3-D matrix and roimtx is a list
 of voxel coordinates

 $Id: compactROI.m,v 1.5 2003/09/15 15:52:18 nknouf Exp $

CROSS-REFERENCE INFORMATION ^

This function calls:

This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function roimtx = compactROI(ROI)
0002 % compactROI -- converts a sparse ROI matrix into a list of voxel coordinates
0003 %
0004 % Since ROIs are quite sparse when represented as [nSlices nRows nColumns], it
0005 % is more space- and time-efficient to store the data as a simple list of
0006 % voxel coordinates, with an optional additional value of some significance
0007 % for each voxel.  compactROI does such a thing, returning a matrix of size
0008 % [num_voxels_in_roi 4], where the four columns correspond to slice number,
0009 % row, column, value at the voxel.  Note that there is some row-/column-major
0010 % trickery that goes on in FS-FAST; look at the source code in FSFAST::ROI for
0011 % details.
0012 %
0013 % roimtx = compactROI(ROI), where ROI is a 3-D matrix and roimtx is a list
0014 % of voxel coordinates
0015 %
0016 % $Id: compactROI.m,v 1.5 2003/09/15 15:52:18 nknouf Exp $
0017 
0018 % License:    Perl Artistic License
0019 % History:    9/10/03, Initial Release
0020 
0021     ind = find(ROI~=0);
0022     if (isempty(ind))
0023         oops(251);
0024     end
0025     values = ROI(ind);
0026     [slice, xcoord, ycoord] = ind2sub(size(ROI), ind);
0027     roimtx = [slice xcoord ycoord values];
0028 return;

Generated at 19:47:41 15-Oct-2003 by m2html © 2003