From 42343ce015a5e74a8612d5bee0e79ef40bcf9b28 Mon Sep 17 00:00:00 2001 From: Emmanuel Promayon Date: Fri, 3 Jan 2020 18:26:16 +0100 Subject: [PATCH] FIXED improved Slice API doc --- sdk/libraries/core/component/Slice.cpp | 15 +----------- sdk/libraries/core/component/Slice.h | 34 ++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/sdk/libraries/core/component/Slice.cpp b/sdk/libraries/core/component/Slice.cpp index f72cd83f..c4a1dbb0 100644 --- a/sdk/libraries/core/component/Slice.cpp +++ b/sdk/libraries/core/component/Slice.cpp @@ -133,7 +133,6 @@ void Slice::volumeToReslicedCoords(const double* xyz, double* ijk) { // -------------------- getNumberOfSlices -------------------- int Slice::getNumberOfSlices() const { - // Array containing first and last indices of the image in each direction // 0 & 1 -> x; 2 and 3 -> y; 4 & 5 -> z int extent[6]; @@ -249,7 +248,6 @@ void Slice::setPixelRealPosition(double x, double y, double z) { updatePixelActor(x, y, z); } - // -------------------- get2DImageActor -------------------- vtkSmartPointer Slice::get2DImageActor() const { return image2DActor; @@ -299,12 +297,7 @@ void Slice::initActors() { // -------------------- initPickPlaneActor -------------------- void Slice::initPickPlaneActor() { - // create the pixel actor 3D geometry - // Create the 8 points that describes the 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, - // for quads are build. Each quad goes out of the image plane on both side - // (hit "t" on the slice viewer and move the camera around to see the quad geometries) + // create the picked plane actor 3D geometry vtkSmartPointer planePoints = vtkSmartPointer::New(); planePoints->SetNumberOfPoints(8); @@ -388,11 +381,6 @@ void Slice::initPickPlaneActor() { // -------------------- initPixelActor -------------------- void Slice::initPixelActor() { // create the pixel actor 3D geometry - // Create the 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. Each quad goes out of the image plane on both side - // (hit "t" on the slice viewer and move the camera around to see the quad geometries) vtkSmartPointer pixelPoints = vtkSmartPointer::New(); pixelPoints->SetNumberOfPoints(8); @@ -595,7 +583,6 @@ bool Slice::addProp(const QString& name, vtkSmartPointer< vtkProp > prop) { //------------------------------- getProp ---------------------------------------- vtkSmartPointer< vtkProp > Slice::getProp(const QString& name) { - if (extraProp.contains(name)) { return extraProp.value(name); } diff --git a/sdk/libraries/core/component/Slice.h b/sdk/libraries/core/component/Slice.h index 8304b9f0..868e787b 100644 --- a/sdk/libraries/core/component/Slice.h +++ b/sdk/libraries/core/component/Slice.h @@ -43,14 +43,38 @@ namespace camitk { * @ingroup group_sdk_libraries_core_component * * @brief - * Display a slice (i.e. an image or BitMap) of an @ref camitk::ImageComponent "ImageComponent" - * - * Uses vtkImageActor::SetDisplayExtent for 3D and 2D Axial, Coronal and Sagittal representaiton. - * Re-position the camera for the 2D views. + * Display a slice (i.e. an image or BitMap) of an @ref camitk::ImageComponent "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 slice is represented in 2D and 3D thanks to: + * - image2DActor that provides a 2D representation (the slice in the world reference frame) + * - image3DActor that provides a 3D representation (the slice at this actual 3D position) + * Both are updated thanks to vtkImageActor::SetDisplayExtent. + * + * \note the setImageWorldTransform(...) methods is used to set the user transform of the image 3D actor. * * Slice also manages two other actors to visualize user picking inside the image: - * - + * - the picked plane actor (a wireframe box made of 4 quads around the picked plane) that shows the image border + * - the picked pixel actor (two wireframe quads centered on the currently picked pixel) that shows the position + * of the currently picked pixel. + * These two actors are build using unstructured grids. + * + * 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 + * + * \note (easter egg) hit "t" on any slice viewer and move the camera around to see the quad geometries and + * how these extra actors are build. * + * * \verbatim * 3D Volume 2D Slice * ________ /|\ -- GitLab