Display a slice (i.e. an image or BitMap) of an ImageComponent. Helper class. More...
#include <Slice.h>
Public Types | |
enum | SliceOrientation { AXIAL, CORONAL, SAGITTAL, AXIAL_NEURO, ARBITRARY } |
Common slices orientation: axial, sagittal, coronal axial_neuro. More... | |
Public Member Functions | |
Constructors / Destructors | |
Constructor | |
Slice (vtkSmartPointer< vtkImageData > volume, SliceOrientation AXIAL_ORIENTATION, vtkSmartPointer< vtkWindowLevelLookupTable > lookupTable=nullptr) | |
~Slice () override | |
virtual destructor More... | |
InterfaceBitMap implementation | |
void | setOriginalVolume (vtkSmartPointer< vtkImageData > img) override final |
set the original volume image data (the source vtkImageData before any reslice) and refresh the vtk pipeline More... | |
void | setImageWorldTransform (vtkSmartPointer< vtkTransform >) override |
set the transformation for 3D image representation This is the transformation relative to the world. More... | |
vtkSmartPointer< vtkImageActor > | get2DImageActor () const override |
Return the vtkImageActor (vtkProp) representing a slice to be displayed in the 2D viewers. More... | |
vtkSmartPointer< vtkImageActor > | get3DImageActor () const override |
Return the vtkImageActor (vtkProp) representing a slice to be displayed in the 3D viewers. More... | |
vtkSmartPointer< vtkActor > | getPickPlaneActor () const override |
Return the vtkActor visualizing the plane of the slices. More... | |
vtkSmartPointer< vtkActor > | getPixelActor () override |
Return the vtkActor visualizing the picked pixels in the slices. More... | |
void | pixelPicked (double, double, double) override |
This method is called when the associated plane has been picked in the InteractiveViewer, the given coordinates is position where the plane was picked. More... | |
void | updatePickPlane () override final |
update the position of the plane surrounding the currently selected slice More... | |
int | getNumberOfSlices () const override final |
Return the number of slices in the image data set. More... | |
int | getSlice () const override |
Return the index of the current displayed slice. More... | |
void | setSlice (int s) override final |
Set the current slice index. More... | |
void | setSlice (double x, double y, double z) override |
Set the slice corresponding to the given real image (RAI) coordinates. More... | |
int | getNumberOfColors () const override |
Return the number of colors in the images. More... | |
void | setPixelRealPosition (double, double, double) override |
move the pixel selection green indicator (pixelActor) to the given real position More... | |
virtual void | setArbitraryTransform (vtkSmartPointer< vtkTransform >) override |
Set the pointer to the arbitrary slice transformation. More... | |
vtkSmartPointer< vtkImageData > | getImageData () const override |
get the current image data More... | |
Public Member Functions inherited from camitk::InterfaceBitMap | |
virtual | ~InterfaceBitMap ()=default |
virtual destructor More... | |
Protected Member Functions | |
Protected utility methods | |
void | init () |
Initialize Attributes. More... | |
void | initActors () |
Initialize actors and everything they need. More... | |
void | reslicedToVolumeCoords (const double *ijk, double *xyz) |
Compute the volume coordinates (xyz) from the resliced coordinates (ijk) More... | |
void | volumeToReslicedCoords (const double *xyz, double *ijk) |
Compute the resliced coordinates (ijk) from the volume coordinates (xyz) More... | |
Protected Attributes | |
Attributes / Members of the class | |
SliceOrientation | sliceOrientation |
Direction of the reslice. More... | |
vtkSmartPointer< vtkImageData > | originalVolume |
Smart pointer to the original volume to reslice (input of the vtk pipeline) More... | |
int | currentSliceIndex |
Keep track of the slice number. More... | |
vtkSmartPointer< vtkWindowLevelLookupTable > | lut |
Common lookup table. More... | |
double | originalSpacing [3] |
Voxel size of the original image volume. More... | |
double | originalSize [3] |
Real size (originalDimension * originalSpacing in x, y and z) of the original image. More... | |
vtkSmartPointer< vtkImageActor > | image3DActor |
3D actor More... | |
vtkSmartPointer< vtkImageActor > | image2DActor |
2D actor More... | |
Management of the arbitrary slice | |
vtkSmartPointer< vtkImageReslice > | image2DReslicer |
The image reslicer computes the arbitrary slice pixels. More... | |
manage extra prop associated with a Slice | |
QMap< QString, vtkSmartPointer< vtkProp > > | extraProp |
The additional map for prop. More... | |
vtkSmartPointer< vtkProp > | getProp (const QString &) override |
Return the vtkProp (actors, volumes and annotations) corresponding to the given name. More... | |
unsigned int | getNumberOfProp () const override |
return the number of additional prop More... | |
vtkSmartPointer< vtkProp > | getProp (unsigned int) override |
return an additional prop by its index More... | |
bool | addProp (const QString &, vtkSmartPointer< vtkProp >) override |
insert an additional prop, defining it by its name (default visibility = false) More... | |
bool | removeProp (const QString &) override |
remove a given additional prop. More... | |
Used to visualize the current picking | |
vtkSmartPointer< vtkActor > | pickPlaneActor |
Actor representing the pickPlane. More... | |
vtkSmartPointer< vtkUnstructuredGrid > | pickPlaneActorPointSet |
the pick plane actor unstructured grid More... | |
vtkSmartPointer< vtkActor > | pixelActor |
Actor representing a pixel, displayed over the image. More... | |
vtkSmartPointer< vtkUnstructuredGrid > | pixelActorPointSet |
the pixel actor unstructured grid More... | |
void | initPickPlaneActor () |
init the pick plane actor More... | |
void | initPixelActor () |
Init the pixel actor for pixel picking. More... | |
void | updatePixelActor (double x, double y, double z) |
Update the pixel actor position according to the specified pixel picked by the user i.e. More... | |
void | updatePixelActor () |
update the pixel actor to the middle of the current slice More... | |
Display a slice (i.e. an image or BitMap) of an ImageComponent. Helper class.
This class manages the visual representation of one slice of a volume image. The slice depends on the orientation and the currently selected slice index. A special case is the arbitrary orientation, where the orientation is not perpendicular to one of the axes, but can have any free orientation and translation.
A slice is represented in 2D and 3D thanks to:
Slice also manages two other actors to visualize user picking inside the image:
The picked plane actor is defined by 8 points surrounding the current image plane. The points are set at the coordinates of the (red / blue / green) border of the current image plane. To make sure that the borders are visible in any specific orientation, four quads are build from this points. Each quad goes out of the image plane on both side (back and front).
The picked pixel actor is also made of 8 points that describes the cross centered on the currently picked pixel. The points are set at the coordinates of the (red / blue / green) cross around the picked pixel. To make sure that the cross is visible in any specific orientation, two quads are build from this 8 points Each quad goes out of the image plane on both side
* 3D Volume 2D Slice * ________ /|\ * /| /| | _______ * /______ / | _|_slice ===> / / Displayed in * | |____|_/| | number /______ / the window * | / |// * |/______|/ * * ________________ * | vtkLookUpTable | * ---| | * | | lut | * | |________________| * setOriginalVolume(..) | * | | setLookUpTable * | setInput | __________________ * | ________________ _______v____________ | vtkImageActor | * | | vtkImageData | | vtkImageMapToColor | |(setDisplayExtent)| * |_\| |----\| |-------------------\ | | * /| originalVolume |----/| imgToMapFilter |-------------------/ | image2DActor | * |________________| |____________________| | | |__________________| * | | * | | _________________________ __________________ * | | | vtkTransformFilter | | vtkImageActor | * | -----------\ |(setWorldTransformation) | --------\|(setDisplayExtent)| * -------------/ | | --------/| | * | | | image3DActor | * |_________________________| |__________________| * * * *
Common slices orientation: axial, sagittal, coronal axial_neuro.
Axial, Sagittal and Coronal orientation are given in Radiologist point of view. The neurologist point of view is displayed in axial_neuro.
The ImageComponent is supposed to be given in RAI orientation. (see the "Reorient Medical Image" Action Documentation).
AXIAL: from feet to head of the patient
CORONAL: from the front to back of the patient
SAGITTAL: from the right to left of the patient
AXIAL_NEURO: from head to feet (other side of AXIAL)
ARBITRARY: any arbitrary orientation.
Enumerator | |
---|---|
AXIAL | |
CORONAL | |
SAGITTAL | |
AXIAL_NEURO | |
ARBITRARY |
camitk::Slice::Slice | ( | vtkSmartPointer< vtkImageData > | volume, |
SliceOrientation | AXIAL_ORIENTATION, | ||
vtkSmartPointer< vtkWindowLevelLookupTable > | lookupTable = nullptr |
||
) |
|
override |
virtual destructor
References originalVolume.
|
overridevirtual |
insert an additional prop, defining it by its name (default visibility = false)
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Return the vtkImageActor (vtkProp) representing a slice to be displayed in the 2D viewers.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Return the vtkImageActor (vtkProp) representing a slice to be displayed in the 3D viewers.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
get the current image data
Implements camitk::InterfaceBitMap.
|
overridevirtual |
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.
|
overridevirtual |
return the number of additional prop
Implements camitk::InterfaceBitMap.
|
finaloverridevirtual |
Return the number of slices in the image data set.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Return the vtkActor visualizing the plane of the slices.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Return the vtkActor visualizing the picked pixels in the slices.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Return the vtkProp (actors, volumes and annotations) corresponding to the given name.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
return an additional prop by its index
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Return the index of the current displayed slice.
Implements camitk::InterfaceBitMap.
References AXIAL, AXIAL_NEURO, currentSliceIndex, and image3DActor.
|
protected |
Initialize Attributes.
References originalSize, originalSpacing, and originalVolume.
|
protected |
Initialize actors and everything they need.
References image2DActor, image2DReslicer, and image3DActor.
|
protected |
init the pick plane actor
|
protected |
Init the pixel actor for pixel picking.
|
overridevirtual |
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.
References AXIAL.
|
overridevirtual |
|
protected |
Compute the volume coordinates (xyz) from the resliced coordinates (ijk)
ijk | given resliced coordinates (generally from a pixel picked in the pickPlane) |
xyz | output (should be allocated before calling this function) volume coordinates (with image at the origin in RAI convention) computed from the input |
|
overridevirtual |
Set the pointer to the arbitrary slice transformation.
this should be done once, at initialization. For SingleImageComponent, it should be the same as the frame of the arbitrary slices (getTransform). This is the transformation relative to the 3D image (it is not parallel to one of the main axe, but has a specific rotation and translation relative to the vtkImage). This is only required for arbitrary orientation.
Implements camitk::InterfaceBitMap.
|
overridevirtual |
set the transformation for 3D image representation This is the transformation relative to the world.
This is required to have the 3D actor properly positioned in world space
Implements camitk::InterfaceBitMap.
References originalSpacing.
|
finaloverridevirtual |
set the original volume image data (the source vtkImageData before any reslice) and refresh the vtk pipeline
Implements camitk::InterfaceBitMap.
|
overridevirtual |
move the pixel selection green indicator (pixelActor) to the given real position
Implements camitk::InterfaceBitMap.
|
overridevirtual |
Set the slice corresponding to the given real image (RAI) coordinates.
Implements camitk::InterfaceBitMap.
|
finaloverridevirtual |
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.
s | the index of the slice to display (base 0). |
Implements camitk::InterfaceBitMap.
|
finaloverridevirtual |
update the position of the plane surrounding the currently selected slice
Implements camitk::InterfaceBitMap.
|
protected |
update the pixel actor to the middle of the current slice
|
protected |
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.
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. |
References image2DActor, image2DReslicer, originalSpacing, and pixelActorPointSet.
|
protected |
Compute the resliced coordinates (ijk) from the volume coordinates (xyz)
xyz | given volume coordinates (with image at the origin in RAI convention) |
ijk | output (should be allocated before calling this function) resliced coordinates computed from the input |
|
protected |
Keep track of the slice number.
Referenced by getSlice().
|
protected |
The additional map for prop.
|
protected |
2D actor
Referenced by initActors(), and updatePixelActor().
|
protected |
The image reslicer computes the arbitrary slice pixels.
Referenced by initActors(), and updatePixelActor().
|
protected |
3D actor
Referenced by getSlice(), and initActors().
|
protected |
Common lookup table.
|
protected |
Real size (originalDimension * originalSpacing in x, y and z) of the original image.
Referenced by init().
|
protected |
Voxel size of the original image volume.
Used to compute point coordinates between real world and index world.
Referenced by init(), setImageWorldTransform(), and updatePixelActor().
|
protected |
|
protected |
Actor representing the pickPlane.
|
protected |
the pick plane actor unstructured grid
|
protected |
Actor representing a pixel, displayed over the image.
|
protected |
the pixel actor unstructured grid
Referenced by updatePixelActor().
|
protected |
Direction of the reslice.