Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Private Member Functions | Private Attributes | List of all members
camitk::Slice Class Reference

Display a slice (i.e. More...

#include <Slice.h>

+ Inheritance diagram for camitk::Slice:

Public Member Functions

Constructors / Destructors
 Slice (vtkSmartPointer< vtkImageData > volume, PossibleOrientation AXIAL_ORIENTATION, vtkSmartPointer< vtkWindowLevelLookupTable > lookupTable=NULL)
 Constructor.
virtual ~Slice ()
 virtual destructor
- Public Member Functions inherited from camitk::InterfaceBitMap
virtual ~InterfaceBitMap ()
 virtual destructor

Protected Member Functions

Protected utility methods
void setTransformOrientation (double xCosines[3], double yCosines[3], double zCosines[3])
 Sets the given rotation transformation to the reslicer without checking anything.
void setTransformOrigin (double resliceOrigin[3])
 Sets the given origin to the reslicer without checking anything.
void initActors ()
 Initialize actors and everything they need.
void setInitialSlicerTransformation ()
 Set transformation for axial, sagittal and coronal (axial as default for arbitrary)
void updateLocalTransformation ()
 Update the coordsTransform attribute (to do when either slicer transformation or slice number has changed).
void computeReslicedDimensions ()
 Computes local coordiantes from original coordinates and slicer transformation.
void setSliceOrientation (PossibleOrientation orientation)
 Set the orientation (and the transform matrix) of the slice.

Private Member Functions

void initPixelActor ()
 Init the pixel actor for pixel picking.
void updatePixelActorPosition (double x, double y, double z)
 Update the pixel actor position according to the specified pixel picked by the user i.e.

Private Attributes

int currentSliceIndex
 Keep track of the slice number.
vtkSmartPointer< vtkImageActor > image3DActor
 3D actor
vtkSmartPointer
< vtkImageMapToColors > 
imgToMapFilter
 To be able to extract a slice.
vtkSmartPointer
< vtkWindowLevelLookupTable > 
lut
 Common lookup table.
vtkSmartPointer< vtkActor > pixelActor
 Actor representing a pixel, displayed over the image.
Use to reslice 2D
int originalDimensions [3]
 Original volume dimensions.
int reslicedDimensions [3]
 Resliced Volume dimensions.
double originalSpacing [3]
 Voxel size of the ORIGINAL image volume.
double resliceSpacing [3]
 Voxel size of the RESLICED image volume.
double currentXAngle
 Angle apply to the arbitrary slice.
double currentYAngle
double currentZAngle
vtkSmartPointer< vtkMatrix4x4 > coordsTransform
 Transform matrix between resliced and original coords.
vtkSmartPointer< vtkMatrix4x4 > sliceCoordsTransform
 Transform matrix between resliced and original coords taking the slice number into account.
vtkSmartPointer< vtkTransform > transformReslice2Volume
 Transformation between the reslice volume and the original volume.
For 2D actor
vtkSmartPointer< vtkImageReslice > image2DReslicer
 Reslicer: cut the volume at the right plane and displays it facing the 2D camera.
vtkSmartPointer
< vtkImageChangeInformation > 
image2DChangeInfo
 To put the origin of the reslicer at (0, 0, 0) (mandatory to visualize 2D actor (axial, coronal or sagittal) properly in a 2D window)
vtkSmartPointer< vtkImageActor > image2DActor
 2D actor itself
Uses for picking
vtkSmartPointer< vtkPlaneSource > pickPlane
 A plane used for picking.
vtkSmartPointer
< vtkPolyDataMapper > 
pickPlaneMapper
 Mapper of the the pickPlane.
vtkSmartPointer< vtkActor > pickPlaneActor
 Actor representing the pickPlane.

InterfaceBitMap implementation

QMap< QString, vtkSmartPointer
< vtkProp > > 
extraProp
 The additional map for prop (include at least "label" and "glyph".
virtual vtkSmartPointer
< vtkImageData > 
getImageData () const
 Return the displayed images as a vtkImageData.
virtual void setOriginalVolume (vtkSmartPointer< vtkImageData > img)
 set the original volume image data (the source vtkImageData before any reslice) and refresh the vtk pipeline
virtual vtkSmartPointer
< vtkImageActor > 
get2DImageActor () const
 Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D.
virtual vtkSmartPointer
< vtkImageActor > 
get3DImageActor () const
 Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D.
virtual vtkSmartPointer< vtkActor > getPickPlaneActor () const
 Return the vtkActor used to pick pixels in the slices.
virtual vtkSmartPointer< vtkActor > getPixelActor ()
 Return the vtkActor used to pick pixels in the slices.
virtual void pixelPicked (double, double, double)
 This method is called when the associated plane has been picked in the InteractiveViewer, the given coordinates is position where the plane was picked.
void reslicedToVolumeCoords (const double ijk[3], double xyz[3])
 Compute the volume coordinates (xyz) from the resliced coordinates (ijk)
void volumeToReslicedCoords (const double xyz[3], double ijk[3])
 Todo, idem...
virtual void updatePickPlane ()
virtual int getNumberOfSlices () const
 Return the number of slices in the image data set.
virtual int getSlice () const
 Return the index of the current displayed slice.
virtual void setSlice (int s)
 Set the current slice index.
virtual void setSlice (double x, double y, double z)
 Set the slice corresponding to the given world coordinates.
virtual double getRotationX () const
 Return the current angle applied to the arbitrary slice.
virtual double getRotationY () const
virtual double getRotationZ () const
virtual void setRotationX (double angle)
 Set the current angle to the arbitrary slice.
virtual void setRotationY (double angle)
virtual void setRotationZ (double angle)
void applyRotation ()
virtual int getNumberOfColors () const
 Return the number of colors in the images.
virtual void setPixelRealPosition (double, double, double)
 move the pixel selection green indicator (pixelActor) to the given real position
virtual vtkSmartPointer< vtkProp > getProp (const QString &)
 Return the vtkProp (actors, volumes and annotations) corresponding to the given name.
virtual unsigned int getNumberOfProp () const
 return the number of additional prop
virtual vtkSmartPointer< vtkProp > getProp (unsigned int)
 return an additional prop by its index
virtual bool addProp (const QString &, vtkSmartPointer< vtkProp >)
 insert an additional prop, defining it by its name (default visibility = false)
virtual bool removeProp (const QString &)
 remove a given additional prop.

Attributes / Members of the class

PossibleOrientation sliceOrientation
 Direction of the reslice.
vtkSmartPointer< vtkImageData > originalVolume
 Smart pointer to the original volume to reslice (input of the vtk pipeline)
int extent [6]
 Table containing first and last indices of the image in each direction 0 & 1 -> x; 2 and 3 -> y; 4 & 5 -> z.
void init ()
 Initialize / Creates members.

Additional Inherited Members

- Public Types inherited from camitk::InterfaceBitMap
enum  PossibleOrientation { AXIAL_ORIENTATION, CORONAL_ORIENTATION, SAGITTAL_ORIENTATION, ARBITRARY_ORIENTATION }
 Common slices orientation: axial, sagittal, coronal or anything else. More...
- Public Attributes inherited from camitk::InterfaceBitMap
QMap< QString, vtkSmartPointer
< vtkProp > > 
extraProp
 The additional map for prop (include at least "label" and "glyph".

Detailed Description

Display a slice (i.e.

an image or BitMap)

Uses vtkImageActor::SetDisplayExtent for 3D Axial, Coronal and Sagittal representaiton. Uses vtkImageReslice for 2D actors (for them to be facing the camera).

*       3D Volume                         2D Slice
*       ________  /|\
*      /|      /|  |                      _______
*     /______ / | _|_slice     ===>      /       /        Displayed in
*    |  |____|_/|  |  number            /______ /         the window
*    | /     |//
*    |/______|/
*
*                                          ________________
*                                         | vtkLookUpTable |
*                                      ---|                |
*                                     |   |    lut         |
*                                     |   |________________|
*  setOriginalVolume(..)              |                                                            __________________
*   |                                 | setLookUpTable                                            |  vtkImageActor   |
*   |                   setInput      |               /------------------------------------------\|(setDisplayExtent)|
*   |   ________________       _______v____________  / /-----------------------------------------/|                  |
*   |  |  vtkImageData  |     | vtkImageMapToColor |/ /                                           |   image3DActor   |
*   |_\|                |----\|                    | /       _________________________            |__________________|
*     /| originalVolume |----/|   imgToMapFilter   |\ \     |vtkImageChangeInformation|
*      |________________|     |____________________| \ \---\|                         |
*                                                     \----/|     image2DChangeInfo   |
*                                                           |_________________________|
*                                                                \ \        _______________        _______________
*                                                                 \ \      |vtkImageReslice|      | vtkImageActor |
*                                                                  \ \----\|               |-----\|               |
*                                                                    -----/|image2DReslicer|-----/|  image2DActor |
*                                                                          |_______________|\     |_______________|
*                                                                                            \
*                                                                                             v
*                                                                                        getImageData()
*
*
*
*
*
*
*
* 

Constructor & Destructor Documentation

camitk::Slice::Slice ( vtkSmartPointer< vtkImageData >  volume,
PossibleOrientation  AXIAL_ORIENTATION,
vtkSmartPointer< vtkWindowLevelLookupTable >  lookupTable = NULL 
)

Constructor.

virtual camitk::Slice::~Slice ( )
inlinevirtual

virtual destructor

Member Function Documentation

bool camitk::Slice::addProp ( const QString &  name,
vtkSmartPointer< vtkProp >  prop 
)
virtual

insert an additional prop, defining it by its name (default visibility = false)

Returns
true if the additional prop was added (i.e. another additional prop of the same name does not exist)

Implements camitk::InterfaceBitMap.

void camitk::Slice::applyRotation ( )
void camitk::Slice::computeReslicedDimensions ( )
protected

Computes local coordiantes from original coordinates and slicer transformation.

vtkSmartPointer< vtkImageActor > camitk::Slice::get2DImageActor ( ) const
virtual

Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D.

Implements camitk::InterfaceBitMap.

vtkSmartPointer< vtkImageActor > camitk::Slice::get3DImageActor ( ) const
virtual

Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D.

Implements camitk::InterfaceBitMap.

vtkSmartPointer< vtkImageData > camitk::Slice::getImageData ( ) const
virtual

Return the displayed images as a vtkImageData.

Implements camitk::InterfaceBitMap.

int camitk::Slice::getNumberOfColors ( ) const
virtual

Return the number of colors in the images.

If color is coded on 1 byte, the images are on 256 grey level. If color is coded on 2 bytes, the images are on 4096 grey level (not 65536).

Implements camitk::InterfaceBitMap.

unsigned int camitk::Slice::getNumberOfProp ( ) const
virtual

return the number of additional prop

Implements camitk::InterfaceBitMap.

int camitk::Slice::getNumberOfSlices ( ) const
virtual

Return the number of slices in the image data set.

Implements camitk::InterfaceBitMap.

vtkSmartPointer< vtkActor > camitk::Slice::getPickPlaneActor ( ) const
virtual

Return the vtkActor used to pick pixels in the slices.

Implements camitk::InterfaceBitMap.

vtkSmartPointer< vtkActor > camitk::Slice::getPixelActor ( )
virtual

Return the vtkActor used to pick pixels in the slices.

Implements camitk::InterfaceBitMap.

vtkSmartPointer< vtkProp > camitk::Slice::getProp ( const QString &  name)
virtual

Return the vtkProp (actors, volumes and annotations) corresponding to the given name.

Implements camitk::InterfaceBitMap.

vtkSmartPointer< vtkProp > camitk::Slice::getProp ( unsigned int  index)
virtual

return an additional prop by its index

Implements camitk::InterfaceBitMap.

virtual double camitk::Slice::getRotationX ( ) const
inlinevirtual

Return the current angle applied to the arbitrary slice.

Implements camitk::InterfaceBitMap.

virtual double camitk::Slice::getRotationY ( ) const
inlinevirtual
virtual double camitk::Slice::getRotationZ ( ) const
inlinevirtual
int camitk::Slice::getSlice ( ) const
virtual

Return the index of the current displayed slice.

Implements camitk::InterfaceBitMap.

void camitk::Slice::init ( )
private

Initialize / Creates members.

void camitk::Slice::initActors ( )
protected

Initialize actors and everything they need.

void camitk::Slice::initPixelActor ( )
private

Init the pixel actor for pixel picking.

void camitk::Slice::pixelPicked ( double  x,
double  y,
double  z 
)
virtual

This method is called when the associated plane has been picked in the InteractiveViewer, the given coordinates is position where the plane was picked.

Implements camitk::InterfaceBitMap.

bool camitk::Slice::removeProp ( const QString &  name)
virtual

remove a given additional prop.

Returns
true if effictively done

Implements camitk::InterfaceBitMap.

void camitk::Slice::reslicedToVolumeCoords ( const double  ijk[3],
double  xyz[3] 
)

Compute the volume coordinates (xyz) from the resliced coordinates (ijk)

Parameters
ijk,:given resliced coordiantes (generally from a pixel picked in the pickPlane)
xyz,:output (should be allocated before calling this function) volume coordinates computed from the inputTodo: put this method in abstract slice
void camitk::Slice::setInitialSlicerTransformation ( )
protected

Set transformation for axial, sagittal and coronal (axial as default for arbitrary)

void camitk::Slice::setOriginalVolume ( vtkSmartPointer< vtkImageData >  img)
virtual

set the original volume image data (the source vtkImageData before any reslice) and refresh the vtk pipeline

Implements camitk::InterfaceBitMap.

void camitk::Slice::setPixelRealPosition ( double  x,
double  y,
double  z 
)
virtual

move the pixel selection green indicator (pixelActor) to the given real position

Implements camitk::InterfaceBitMap.

void camitk::Slice::setRotationX ( double  angle)
virtual

Set the current angle to the arbitrary slice.

Implements camitk::InterfaceBitMap.

void camitk::Slice::setRotationY ( double  angle)
virtual
void camitk::Slice::setRotationZ ( double  angle)
virtual
void camitk::Slice::setSlice ( int  s)
virtual

Set the current slice index.

If the slice index is less than the first slice index, the first slice is displayed. If the slice index is more than the last slice index, the last slice is displayed.

Parameters
sthe index of the slice to display (base 0).

Implements camitk::InterfaceBitMap.

void camitk::Slice::setSlice ( double  x,
double  y,
double  z 
)
virtual

Set the slice corresponding to the given world coordinates.

Implements camitk::InterfaceBitMap.

void camitk::Slice::setSliceOrientation ( PossibleOrientation  orientation)
protected

Set the orientation (and the transform matrix) of the slice.

void camitk::Slice::setTransformOrientation ( double  xCosines[3],
double  yCosines[3],
double  zCosines[3] 
)
protected

Sets the given rotation transformation to the reslicer without checking anything.

void camitk::Slice::setTransformOrigin ( double  resliceOrigin[3])
protected

Sets the given origin to the reslicer without checking anything.

Warning, if the origin is not at (0,0,s) or any combination, the pickPlane may not be correctly placed.

void camitk::Slice::updateLocalTransformation ( )
protected

Update the coordsTransform attribute (to do when either slicer transformation or slice number has changed).

void camitk::Slice::updatePickPlane ( )
virtual
void camitk::Slice::updatePixelActorPosition ( double  x,
double  y,
double  z 
)
private

Update the pixel actor position according to the specified pixel picked by the user i.e.

Compute and draw the bounding box around the selected pixel.

Parameters
x,:The absciss value of the selected pixel
y,:The ordinate value of the selected pixel
z,:The depth value of the selected pixel. In the plane, it's always +/- 0.01 in order to the pixel actor to be visible over the slice.
void camitk::Slice::volumeToReslicedCoords ( const double  xyz[3],
double  ijk[3] 
)

Todo, idem...

Member Data Documentation

vtkSmartPointer<vtkMatrix4x4> camitk::Slice::coordsTransform
private

Transform matrix between resliced and original coords.

int camitk::Slice::currentSliceIndex
private

Keep track of the slice number.

double camitk::Slice::currentXAngle
private

Angle apply to the arbitrary slice.

double camitk::Slice::currentYAngle
private
double camitk::Slice::currentZAngle
private
int camitk::Slice::extent[6]
private

Table containing first and last indices of the image in each direction 0 & 1 -> x; 2 and 3 -> y; 4 & 5 -> z.

QMap<QString, vtkSmartPointer<vtkProp> > camitk::Slice::extraProp

The additional map for prop (include at least "label" and "glyph".

vtkSmartPointer<vtkImageActor> camitk::Slice::image2DActor
private

2D actor itself

vtkSmartPointer<vtkImageChangeInformation> camitk::Slice::image2DChangeInfo
private

To put the origin of the reslicer at (0, 0, 0) (mandatory to visualize 2D actor (axial, coronal or sagittal) properly in a 2D window)

vtkSmartPointer<vtkImageReslice> camitk::Slice::image2DReslicer
private

Reslicer: cut the volume at the right plane and displays it facing the 2D camera.

vtkSmartPointer<vtkImageActor> camitk::Slice::image3DActor
private

3D actor

vtkSmartPointer<vtkImageMapToColors> camitk::Slice::imgToMapFilter
private

To be able to extract a slice.

vtkSmartPointer<vtkWindowLevelLookupTable> camitk::Slice::lut
private

Common lookup table.

int camitk::Slice::originalDimensions[3]
private

Original volume dimensions.

double camitk::Slice::originalSpacing[3]
private

Voxel size of the ORIGINAL image volume.

Used to compute point coordinates between real world and index world.

vtkSmartPointer<vtkImageData> camitk::Slice::originalVolume
private

Smart pointer to the original volume to reslice (input of the vtk pipeline)

vtkSmartPointer<vtkPlaneSource> camitk::Slice::pickPlane
private

A plane used for picking.

This plane has the same size and position as the displayed slice. However, it is a real vtkActor that can be easily picked (using 'p' ot 'Ctrl+left click').

vtkSmartPointer<vtkActor> camitk::Slice::pickPlaneActor
private

Actor representing the pickPlane.

vtkSmartPointer<vtkPolyDataMapper> camitk::Slice::pickPlaneMapper
private

Mapper of the the pickPlane.

vtkSmartPointer<vtkActor> camitk::Slice::pixelActor
private

Actor representing a pixel, displayed over the image.

int camitk::Slice::reslicedDimensions[3]
private

Resliced Volume dimensions.

double camitk::Slice::resliceSpacing[3]
private

Voxel size of the RESLICED image volume.

Used to compute point coordinates between real world and index world.

vtkSmartPointer<vtkMatrix4x4> camitk::Slice::sliceCoordsTransform
private

Transform matrix between resliced and original coords taking the slice number into account.

PossibleOrientation camitk::Slice::sliceOrientation
private

Direction of the reslice.

vtkSmartPointer<vtkTransform> camitk::Slice::transformReslice2Volume
private

Transformation between the reslice volume and the original volume.


The documentation for this class was generated from the following files: