Commit 50da617f authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED missing new class code

parent 5484398d
......@@ -159,7 +159,7 @@ bool SetAnglesAction::event(QEvent* e) {
// do something depending of the property that has changed
if (changeEvent->propertyName() == "Translation") {
currentImageComp->setTransformTranslation(0.0, 0.0, property(changeEvent->propertyName()).toDouble());
currentImageComp->setTransformTranslation(0.0, 0.0, property(changeEvent->propertyName()).toDouble()/100.0);
}
else {
currentImageComp->setTransformRotation(property("X Angle").toInt(), property("Y Angle").toInt(), property("Z Angle").toInt());
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef ARBITRARYSINGLEIMAGEVOLUMECOMPONENT_H
#define ARBITRARYSINGLEIMAGEVOLUMECOMPONENT_H
// -- Core stuff
#include "SingleImageComponent.h"
#include "Slice.h"
// -- QT stuff classes
class QMenu;
// -- VTK stuff
#include <vtkImageReslice.h>
#include <vtkWindowLevelLookupTable.h>
#include <vtkImageChangeInformation.h>
// -- VTK stuff classes
class vtkImageClip;
namespace camitk {
/**
* @ingroup group_sdk_libraries_core_component_image
*
* @brief
* This Component manages the specific case of arbitrary orientation of a sub-component of the image component.
*
* Arbitrary slice frame is used to position and orientate the slice inside the parent image volume.
*
* It does have a Slice representation (InterfaceBitMap), not a Geometry.
*
* Some frame management methods (inherited from InterfaceFrame) are overriden in order to manage
* the arbitrary orientation.
*
* These method should allow the displacement but constrained it
* so that the center of the arbitrary slice is always inside the parent ImageComponent
* volume.
*
* For arbitrary slice, the default transform is set to be on the z plane
* but in the middle of the volume.
*
* The initial position of the frame has therefore no rotation
* and a translation equals to (0, 0, dim[2]*spacing[2])
*
* Note:
* - setSlice methods on arbitrary slice do nothing
* - getSlice and getNumberOfSlices return 0.0
* Use getTranslationInVolume() method to know where the slice is relatively to the parent ImageComponent.
*
*/
class CAMITK_API ArbitrarySingleImageComponent : public camitk::SingleImageComponent {
Q_OBJECT
/// Set Axial, Coronal and Sagittal Slices visible in 3D
Q_PROPERTY(bool viewSliceIn3D READ getViewSliceIn3D WRITE setViewSliceIn3D)
public:
/// Constructor
ArbitrarySingleImageComponent(Component* parentComponent, const QString& name, vtkSmartPointer<vtkWindowLevelLookupTable> lut);
/// Destructor
~ArbitrarySingleImageComponent() override = default;
/// @name overriden from Component to manage arbitrary orientation
/// @{
/// same as default but notify the slice as well
virtual void setTransform(vtkSmartPointer<vtkTransform>) override;
/// reset the transformation to the image component parent so that the frame
/// of the arbitrary slice is in the center of the volume along the z axis by default
virtual void resetTransform() override;
/// set the arbitrary slice translation inside the volume between 0 and 1 (first two parameters are ignored)
virtual void setTransformTranslation(double, double, double) override;
/// rotate of the given angles around the center of the frame/arbitrary slice
virtual void setTransformRotation(double, double, double) override;
/// translation along the z axis (TODO Not yet implemented)
virtual void translate(double, double, double) override;
/// rotate on the slide center (TODO Not yet implemented)
virtual void rotate(double, double, double) override;
/// rotate on the slide center using the VTK way (TODO Not yet implemented)
virtual void rotateVTK(double, double, double) override;
/// set translation the VTK way (TODO Not yet implemented)
virtual void setTransformTranslationVTK(double, double, double) override;
/// set rotation the VTK way (TODO Not yet implemented)
virtual void setTransformRotationVTK(double, double, double) override;
/// @}
/// rewritten to do nothing. For arbitrary slice use setTransformTranslation and getTranslationInVolume instead
virtual void setSlice(int) override;
/// rewritten because the setSlice(int) method is overriden (compiler needs this)
virtual void setSlice(double, double, double) override;
/// rewritten: always return 0. For arbitrary slice use setTransformTranslation and getTranslationInVolume instead
virtual int getSlice() const override;
/// rewritten: always return 0. For arbitrary slice use setTransformTranslation and getTranslationInVolume instead
virtual int getNumberOfSlices() const override;
/// Get the current translation relatively to the volume
/// 0.0 means that the center of the slice is at the first border of the image volume
/// 1.0 means that the center of the slice is
/// \note: the center of the slice is the center of rotation
///
virtual double getTranslationInVolume();
private:
/// check if the center of the frame transformed usin the given matrix stays inside the initial image volume
bool checkCenter(vtkSmartPointer<vtkMatrix4x4>);
/// dimension of the whole image (kept here for simplifying code)
int* dimensions;
/// spacing of the image (kept here for simplifying code)
double *spacing;
};
}
#endif // ARBITRARYSINGLEIMAGEVOLUMECOMPONENT_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment