Computer Assited Medical Intervention Tool Kit  version 4.0
ImageComponent.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef IMAGE_COMPONENT_H
27 #define IMAGE_COMPONENT_H
28 
29 // -- Core image component stuff
30 #include "SingleImageComponent.h"
31 #include "CamiTKAPI.h"
32 #include "ImageOrientationHelper.h"
33 
34 // -- vtk stuff
35 #include <vtkPolyData.h>
36 #include <vtkSmartPointer.h>
37 #include <vtkImageData.h>
38 #include <vtkTransform.h>
39 #include <vtkImageFlip.h>
40 #include <vtkWindowLevelLookupTable.h>
41 #include <vtkMatrix4x4.h>
42 
43 // -- QT stuff classes
44 class QMenu;
45 class QTableView;
46 class QVector3D;
47 class QVariant;
48 class QTableView;
49 class QStandardItemModel;
50 
51 namespace camitk {
52 
53 class MeshComponent;
54 
70  Q_OBJECT
71 
72 public:
74  ImageComponent( const QString & file ) throw( AbortException ) ;
75 
84  ImageComponent( vtkSmartPointer<vtkImageData> anImageData, const QString &name, bool copy = false, ImageOrientationHelper::PossibleImageOrientations initialOrientation = ImageOrientationHelper::RAI )
85  throw( AbortException ) ;
86 
88  virtual ~ImageComponent();
89 
91  virtual void setSelected( const bool b, const bool recursive = false );
92 
94  QString getImageName() const;
95  void setImageName( const QString& );
96 
98  vtkSmartPointer<vtkImageData> getImageData() const {
99  return originalImageData;
100  }
101 
107  vtkSmartPointer<vtkImageData> getImageDataWithFrameTransform();
108 
111  return initialOrientation;
112  }
113 
118  void pixelPicked( double x, double y, double z, SingleImageComponent *whoIsAsking );
119 
122  void getLastPixelPicked( int * x, int * y, int * z );
123 
126  void getLastPointPickedImageCoords( double * x, double * y, double * z );
127 
130  void getLastPointPickedWorldCoords( double * x, double * y, double * z );
131 
132 
137  int getNumberOfColors() const;
138 
140  double getMinColor() const;
141 
143  double getMaxColor() const;
144 
148  int getActualNumberOfColors() const;
149 
151  double getActualMinColor() const;
152 
154  double getActualMaxColor() const;
155 
157  int getNumberOfSlices() const;
158 
160  virtual void setLut( vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable );
161 
163  virtual vtkSmartPointer<vtkWindowLevelLookupTable> getLut();
164 
167  virtual void refresh() const;
168 
170  SingleImageComponent * getAxialSlices();
172  SingleImageComponent * getCoronalSlices();
174  SingleImageComponent * getSagittalSlices();
176  SingleImageComponent * getArbitrarySlices();
178  MeshComponent * getVolumeRenderingChild();
179 
185  virtual void replaceImageData( vtkSmartPointer<vtkImageData> anImageData, bool copy = false, ImageOrientationHelper::PossibleImageOrientations initialOrientation = ImageOrientationHelper::RAI );
186 
188  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
192  QVariantMap getImageSize() const;
194  QString getDataType() const;
195  QVector3D getVoxelSize() const;
196  QVector3D getImageOrigin() const;
197  bool getViewIn3D() const;
198  void setViewIn3D( bool );
199  //@endcond
200 
201 
206  virtual void updateProperty( QString, QVariant );
209 
211  virtual unsigned int getNumberOfPropertyWidget();
212 
214  virtual QWidget * getPropertyWidgetAt( unsigned int i, QWidget* parent = 0 );
216 
217  const vtkSmartPointer<vtkMatrix4x4> getRotationMatrix() {
218  return rotationMatrix;
219  }
220 
221 protected:
222 
230  virtual void setImageData( vtkSmartPointer<vtkImageData> anImageData,
231  bool copy,
233  vtkSmartPointer<vtkMatrix4x4> initialTransformMatrix = NULL);
234 
245  virtual void updateImageProperties();
246 
247 private:
248 
250  virtual void initRepresentation() {}
251 
252  // builds default lookup table
253  void initLookupTable();
254 
256  void buildImageComponents();
257 
258  void updateImageComponents();
259 
262  vtkSmartPointer<vtkPolyData> getBoundingBox();
263 
265  vtkSmartPointer<vtkImageData> originalImageData;
266 
271 
275 
277  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
278 
280  double currentPixelPicked[3];
281 
283  virtual void init();
284 
286  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
290  QString imageName;
292 
294  bool viewIn3D;
295 
296  //@endcond
297 
299  QTableView* selectionView;
300 
302  QStandardItemModel *model;
303 
306 
310  vtkSmartPointer<vtkTransform> initialImageDataTransform;
311 
316  vtkSmartPointer<vtkTransform> initialFrameTransform;
317 
320  vtkSmartPointer<vtkMatrix4x4> rotationMatrix;
321 };
322 
323 }
324 
325 #endif //IMAGE_COMPONENT_H
SingleImageComponent * sagittalSlices
Definition: ImageComponent.h:268
QTableView * selectionView
Tab displaying data selected point in the property explorer.
Definition: ImageComponent.h:299
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
vtkSmartPointer< vtkTransform > initialFrameTransform
The initial frame of the image at opening.
Definition: ImageComponent.h:316
QStandardItemModel * model
Model to display data.
Definition: ImageComponent.h:302
MeshComponent * volumeRenderingChild
When an action computes volume rendering for an image, it stores the corresponding actor as a prop of...
Definition: ImageComponent.h:274
ImageOrientationHelper::PossibleImageOrientations getInitialOrientation() const
Get the initial image orientation.
Definition: ImageComponent.h:110
This Component manages a set of images, destined to be seen in a single orientation only (axial OR sa...
Definition: SingleImageComponent.h:55
Definition: Action.cpp:40
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:51
virtual void initRepresentation()
the concrete building of the 3D objects (Slice/Geometry): none in this case!
Definition: ImageComponent.h:250
SingleImageComponent * axialSlices
Definition: ImageComponent.h:267
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:299
vtkSmartPointer< vtkMatrix4x4 > rotationMatrix
The rotation matrix, that might have been altered by the user Will be saved in header file informatio...
Definition: ImageComponent.h:320
#define CAMITK_API
Definition: CamiTKAPI.h:49
ImageOrientationHelper::PossibleImageOrientations initialOrientation
Initial image orientation.
Definition: ImageComponent.h:305
The manager of the Image Volume data.
Definition: ImageComponent.h:69
PossibleImageOrientations
For each axis (x, y or z), 6 possibilities:
Definition: ImageOrientationHelper.h:52
const vtkSmartPointer< vtkMatrix4x4 > getRotationMatrix()
Definition: ImageComponent.h:217
Direct Orientations X: Right to Left, Y: Anterior to Posterior, Z: Inferior to Superiror.
Definition: ImageOrientationHelper.h:55
vtkSmartPointer< vtkTransform > initialImageDataTransform
The initial transform to the vtkImageData.
Definition: ImageComponent.h:310
SingleImageComponent * coronalSlices
Definition: ImageComponent.h:269
vtkSmartPointer< vtkImageData > originalImageData
the core Image Volume that is managed here
Definition: ImageComponent.h:265
vtkSmartPointer< vtkImageData > getImageData() const
get the image volume managed by this Component
Definition: ImageComponent.h:98
SingleImageComponent * arbitrarySlices
Definition: ImageComponent.h:270
vtkSmartPointer< vtkWindowLevelLookupTable > lut
the current lookup table
Definition: ImageComponent.h:277