Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

vlSlice Class Reference

The goal of this class is to provide access to a volume in a slice-by-slice basis. More...

#include <vlslice.h>

Inheritance diagram for vlSlice:

vlSliceInfo List of all members.

Public Member Functions

 vlSlice (vlVolume &vol, vlNormal< float > const &normal=vlNormal< float >(0.0, 0.0, 1.0))
 Default constructor.

virtual ~vlSlice ()
 Default destructor.

void setDefaultParams ()
 Sets the slice parameters to default values.

bool setNormal (vlNormal< float > const &normal)
 Set the normal for the next slice.

bool setNormal (vlAxis const axis)
 Set the normal for the next slice.

bool setSlicePos (float slicePos)
 Set the slice number to extract next.

bool setSlicePos (uint16 slicePos)
 Set the slice number to extract next.

bool moveSlicePos (float deltaShift)
 Move the slice position by deltaShift.

bool isValid ()
 Checks if the slice data is valid.

bool extractSlice ()
 Extracts the slice from the volume using the given information.

void * dataPtr () const
 Get the data pointer to the slice data.

const vlSliceInfofutureParams () const
 Get the future values of the parameters stored in m_newParams.

vlPoint3f getVoxelPos (const uint16 xPos, const uint16 yPos) const
 Get the position of the voxel wrt the volume from the pos wrt the slice.

vlSliceVoxelInfo getVoxelInfo (const uint16 xPos, const uint16 yPos) const
 Get all the info. about the voxel at position xPos, yPos on this slice.

vlPoint2f getSlicePos (const vlPoint3f &voxelPos) const
 Get position on slice for a give voxel in the volume.


Protected Member Functions

bool updateNormal ()
 check for a new normal and set parameters accordingly

template<class DataType> bool extractSliceT (DataType dummy)
 Templetized version of extractSlice.

template<class DataType> bool extractXSlice (DataType dummy, unsigned int sliceNo)
 Routine to create slice along X axis.

template<class DataType> bool extractYSlice (DataType dummy, unsigned int sliceNo)
 Routine to create slice along Y axis.

template<class DataType> bool extractZSlice (DataType dummy, unsigned int sliceNo)
 Routine to create slice along Z axis.


Protected Attributes

vlVolumem_rVolume
 The volume associated with the slice.

void * m_pSliceData
 Void pointer to data since type is unknown.

vlTriple< uint32m_storedSlicePos
 Stores the position of slices along each axis.

vlSliceInfo m_newParams
 Parameters modified by set---() functions - this will be used by next call to createSlice().


Detailed Description

Every vlSlice object will be associated with a vlVolume. vlSlice will return the slice requested from the associated volume.

Todo:
Think of using vlVolDataLinear<> for storing slice data
Author:
Sarang Lakare
See also:
vlVolume

Definition at line 50 of file vlslice.h.


Constructor & Destructor Documentation

vlSlice::vlSlice vlVolume vol,
vlNormal< float > const &  normal = vlNormal<float>(0.0, 0.0, 1.0)
 

Parameters:
vol VLVolume to be associated with.

Definition at line 42 of file vlslice.cpp.

References m_pSliceData, and setDefaultParams().

vlSlice::~vlSlice  )  [virtual]
 

Definition at line 56 of file vlslice.cpp.

References m_pSliceData.


Member Function Documentation

void * vlSlice::dataPtr  )  const
 

Definition at line 465 of file vlslice.cpp.

References m_pSliceData.

bool vlSlice::extractSlice  ) 
 

Returns:
true if slice extraction was successful. Else, false.

Definition at line 266 of file vlslice.cpp.

References callFunctionOnDataTypeNoArgs, vlVolume::dataType(), extractSliceT(), and m_rVolume.

template<class DataType>
bool vlSlice::extractSliceT DataType  dummy  )  [protected]
 

Parameters:
DataType 
dummy 
sliceNo 
Returns:
Todo:
Write code to extract slice given the normal and position.

Definition at line 285 of file vlslice.cpp.

References extractXSlice(), extractYSlice(), extractZSlice(), vlSliceInfo::m_axis, m_newParams, vlSliceInfo::m_slicePos, m_storedSlicePos, uint32, VL_X_AXIS, VL_Y_AXIS, VL_Z_AXIS, vlTriple< uint32 >::x(), vlTriple< uint32 >::y(), and vlTriple< uint32 >::z().

Referenced by extractSlice().

template<class DataType>
bool vlSlice::extractXSlice DataType  dummy,
unsigned int  sliceNo
[protected]
 

Slice along X will have voxels that first go along Y and then Z

Parameters:
DataType 
dummy 
sliceNo 
Returns:

Definition at line 385 of file vlslice.cpp.

References vlVolume::dim(), vlVolIterConst< DataType, Layout >::get(), m_pSliceData, m_rVolume, vlVolIterConst< DataType, Layout >::moveTo(), vlVolIterConst< DataType, Layout >::nextYZX(), vlPoint3ui, vlTriple< uint16 >::y(), and vlTriple< uint16 >::z().

Referenced by extractSliceT().

template<class DataType>
bool vlSlice::extractYSlice DataType  dummy,
unsigned int  sliceNo
[protected]
 

Slice along Y will have voxels going first along Z and then X

Parameters:
DataType 
dummy 
sliceNo 
Returns:

Definition at line 430 of file vlslice.cpp.

References vlVolume::dim(), vlVolIterConst< DataType, Layout >::get(), m_pSliceData, m_rVolume, vlVolIterConst< DataType, Layout >::moveTo(), vlVolIterConst< DataType, Layout >::nextZXY(), vlPoint3ui, vlTriple< uint16 >::x(), and vlTriple< uint16 >::z().

Referenced by extractSliceT().

template<class DataType>
bool vlSlice::extractZSlice DataType  dummy,
unsigned int  sliceNo
[protected]
 

Parameters:
DataType 
dummy 
sliceNo 
Returns:

Definition at line 340 of file vlslice.cpp.

References vlVolume::dim(), vlVolIterConst< DataType, Layout >::get(), m_pSliceData, m_rVolume, vlVolIterConst< DataType, Layout >::moveTo(), vlVolIterConst< DataType, Layout >::nextXYZ(), vlPoint3ui, vlTriple< uint16 >::x(), and vlTriple< uint16 >::y().

Referenced by extractSliceT().

const vlSliceInfo * vlSlice::futureParams  )  const
 

Definition at line 471 of file vlslice.cpp.

References m_newParams.

vlPoint2f vlSlice::getSlicePos const vlPoint3f voxelPos  )  const
 

the x and y of returned 2D point will be set to -1 if the voxel is outside of the current slice.

Definition at line 531 of file vlslice.cpp.

References vlSliceInfo::m_axis, VL_OTHER_AXIS, VL_X_AXIS, VL_Y_AXIS, VL_Z_AXIS, vlPoint2f, vlTriple< float >::x(), vlTriple< float >::y(), and vlTriple< float >::z().

vlSliceVoxelInfo vlSlice::getVoxelInfo const uint16  xPos,
const uint16  yPos
const
 

Definition at line 509 of file vlslice.cpp.

References vlVolume::bytesPerVoxel(), vlVolume::dataType(), getVoxelPos(), m_pSliceData, m_rVolume, vlSliceInfo::m_xDim, vlSliceInfo::m_yDim, vlSliceVoxelInfo::setDataType(), vlSliceVoxelInfo::setPos(), vlSliceVoxelInfo::setSlicePos(), vlSliceVoxelInfo::setValid(), and vlSliceVoxelInfo::setValue().

vlPoint3f vlSlice::getVoxelPos const uint16  xPos,
const uint16  yPos
const
 

Todo:
Computer voxel position from the given slice for arbitrary axis.

Definition at line 480 of file vlslice.cpp.

References vlSliceInfo::m_axis, vlSliceInfo::m_slicePos, VL_OTHER_AXIS, VL_X_AXIS, VL_Y_AXIS, and VL_Z_AXIS.

Referenced by getVoxelInfo().

bool vlSlice::isValid  ) 
 

Always check the validity of the data using this function before accessing the data.

Returns:
true - data is valid, false otherwise

Definition at line 179 of file vlslice.cpp.

References m_pSliceData, vlSliceInfo::m_sliceCount, vlSliceInfo::m_xDim, and vlSliceInfo::m_yDim.

bool vlSlice::moveSlicePos float  deltaShift  ) 
 

Parameters:
slicePos The position of the slice [0 - (sliceCount-1)]

Definition at line 159 of file vlslice.cpp.

References m_newParams, vlSliceInfo::m_sliceCount, and vlSliceInfo::m_slicePos.

void vlSlice::setDefaultParams  ) 
 

The normal is set to (0.0, 0.0, 1.0), thus the next call to extractSlice will create a slice along Z axis. Also, the slce no. is set to sliceCount/2, giving the slice in the middle of the volume along Z.

Definition at line 195 of file vlslice.cpp.

References vlVolume::dataType(), vlVolume::dim(), vlSliceInfo::m_axis, vlSliceInfo::m_dataType, m_newParams, vlSliceInfo::m_normal, m_rVolume, vlSliceInfo::m_sliceCount, vlSliceInfo::m_slicePos, m_storedSlicePos, vlSliceInfo::m_xDim, vlSliceInfo::m_yDim, uint32, VL_Z_AXIS, vlNormal3f, vlTriple< uint32 >::x(), vlTriple< uint16 >::x(), vlTriple< uint32 >::y(), vlTriple< uint16 >::y(), vlTriple< uint32 >::z(), and vlTriple< uint16 >::z().

Referenced by vlSlice().

bool vlSlice::setNormal vlAxis const  axis  ) 
 

bool vlSlice::setNormal vlNormal< float > const &  normal  ) 
 

Normal will be a direction perpendicular to the slice surface. The new normal will come into effect only on the next call of extractSlice()

Parameters:
normal vlNormal perpendicular to the slice surface.

Definition at line 71 of file vlslice.cpp.

References m_newParams, vlSliceInfo::m_normal, and updateNormal().

bool vlSlice::setSlicePos uint16  slicePos  ) 
 

Parameters:
slicePos The position of the slice [0 - (sliceCount-1)]

Definition at line 143 of file vlslice.cpp.

References m_newParams, vlSliceInfo::m_sliceCount, and vlSliceInfo::m_slicePos.

bool vlSlice::setSlicePos float  slicePos  ) 
 

Parameters:
slicePos The position of the slice [0 - (sliceCount-1)]

Definition at line 126 of file vlslice.cpp.

References m_newParams, vlSliceInfo::m_sliceCount, and vlSliceInfo::m_slicePos.

bool vlSlice::updateNormal  )  [protected]
 

if m_newNormal has a new normal) and update other parameters (slice dimensions, slice count etc.).

Definition at line 221 of file vlslice.cpp.

References vlVolume::dim(), vlSliceInfo::m_axis, m_newParams, vlSliceInfo::m_normal, m_rVolume, vlSliceInfo::m_sliceCount, vlSliceInfo::m_slicePos, m_storedSlicePos, vlSliceInfo::m_xDim, vlSliceInfo::m_yDim, vlVector< float >::normalize(), VL_X_AXIS, VL_Y_AXIS, VL_Z_AXIS, vlTriple< uint32 >::x(), vlTriple< uint16 >::x(), vlNormal< float >::x(), vlTriple< uint32 >::y(), vlTriple< uint16 >::y(), vlNormal< float >::y(), vlTriple< uint32 >::z(), vlTriple< uint16 >::z(), and vlNormal< float >::z().

Referenced by setNormal().


Member Data Documentation

vlSliceInfo vlSlice::m_newParams [protected]
 

Definition at line 132 of file vlslice.h.

Referenced by extractSliceT(), futureParams(), moveSlicePos(), setDefaultParams(), setNormal(), setSlicePos(), and updateNormal().

void* vlSlice::m_pSliceData [protected]
 

Definition at line 126 of file vlslice.h.

Referenced by dataPtr(), extractXSlice(), extractYSlice(), extractZSlice(), getVoxelInfo(), isValid(), vlSlice(), and ~vlSlice().

vlVolume& vlSlice::m_rVolume [protected]
 

Definition at line 123 of file vlslice.h.

Referenced by extractSlice(), extractXSlice(), extractYSlice(), extractZSlice(), getVoxelInfo(), setDefaultParams(), and updateNormal().

vlTriple<uint32> vlSlice::m_storedSlicePos [protected]
 

Definition at line 129 of file vlslice.h.

Referenced by extractSliceT(), setDefaultParams(), and updateNormal().


The documentation for this class was generated from the following files:
Generated on Fri Mar 18 11:33:19 2005 for OpenVL by doxygen 1.3.3