Computer Assited Medical Intervention Tool Kit  version 4.1
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-2018 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 
74  Q_OBJECT
75 
76 public:
79  ImageComponent(const QString& file);
80 
91  ImageComponent(vtkSmartPointer<vtkImageData> anImageData, const QString& name, bool copy = false, ImageOrientationHelper::PossibleImageOrientations initialOrientation = ImageOrientationHelper::RAI);
92 
94  ~ImageComponent() override;
95 
97  void setSelected(const bool b, const bool recursive = false) override;
98 
100  QString getImageName() const;
101  void setImageName(const QString&);
102 
104  vtkSmartPointer<vtkImageData> getImageData() const {
105  return originalImageData;
106  }
107 
113  vtkSmartPointer<vtkImageData> getImageDataWithFrameTransform();
114 
117  return initialOrientation;
118  }
119 
124  void pixelPicked(double x, double y, double z, SingleImageComponent* whoIsAsking);
125 
128  void getLastPixelPicked(int* x, int* y, int* z);
129 
132  void getLastPointPickedImageCoords(double* x, double* y, double* z);
133 
136  void getLastPointPickedWorldCoords(double* x, double* y, double* z);
137 
138 
143  int getNumberOfColors() const override;
144 
146  double getMinColor() const;
147 
149  double getMaxColor() const;
150 
154  int getActualNumberOfColors() const;
155 
157  double getActualMinColor() const;
158 
160  double getActualMaxColor() const;
161 
163  int getNumberOfSlices() const override;
164 
166  virtual void setLut(vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable);
167 
169  virtual vtkSmartPointer<vtkWindowLevelLookupTable> getLut();
170 
173  void refresh() const override;
174 
176  SingleImageComponent* getAxialSlices();
178  SingleImageComponent* getCoronalSlices();
180  SingleImageComponent* getSagittalSlices();
182  SingleImageComponent* getArbitrarySlices();
184  MeshComponent* getVolumeRenderingChild();
185 
191  virtual void replaceImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy = false, ImageOrientationHelper::PossibleImageOrientations initialOrientation = ImageOrientationHelper::RAI);
192 
197  void updateProperty(QString, QVariant) override;
200 
202  unsigned int getNumberOfPropertyWidget() override;
203 
205  QWidget* getPropertyWidgetAt(unsigned int i) override;
207 
208  const vtkSmartPointer<vtkMatrix4x4> getRotationMatrix() {
209  return rotationMatrix;
210  }
211 
212 
213 protected:
214 
222  virtual void setImageData(vtkSmartPointer<vtkImageData> anImageData,
223  bool copy,
225  vtkSmartPointer<vtkMatrix4x4> initialTransformMatrix = nullptr);
226 
236  virtual void setSingleImageComponents(SingleImageComponent* axialSlices, SingleImageComponent* sagittalSlices, SingleImageComponent* coronalSlices, SingleImageComponent* arbitrarySlices);
237 
238 private:
249  virtual void initImageProperties();
250 
253 
254  // builds default lookup table
255  void initLookupTable();
256 
258  void buildImageComponents();
259 
261  void updateImageComponents();
262 
268  void update3DViewer();
269 
272  vtkSmartPointer<vtkPolyData> getBoundingBox();
273 
275  vtkSmartPointer<vtkImageData> originalImageData;
276 
279 
282 
285 
288 
292 
294  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
295 
297  double currentPixelPicked[3];
298 
300  virtual void init();
301 
303  QTableView* selectionView;
304 
306  QStandardItemModel* model;
307 
310 
314  vtkSmartPointer<vtkTransform> initialImageDataTransform;
315 
320  vtkSmartPointer<vtkTransform> initialFrameTransform;
321 
324  vtkSmartPointer<vtkMatrix4x4> rotationMatrix;
325 };
326 
327 }
328 
329 #endif //IMAGE_COMPONENT_H
SingleImageComponent * sagittalSlices
the sagittal slices representation (all intelligence is delegated to a Slice class instance) ...
Definition: ImageComponent.h:281
QTableView * selectionView
Tab displaying data selected point in the property explorer.
Definition: ImageComponent.h:303
vtkSmartPointer< vtkTransform > initialFrameTransform
The initial frame of the image at opening.
Definition: ImageComponent.h:320
QStandardItemModel * model
Model to display data.
Definition: ImageComponent.h:306
MeshComponent * volumeRenderingChild
When an action computes volume rendering for an image, it stores the corresponding actor as a prop of...
Definition: ImageComponent.h:291
ImageOrientationHelper::PossibleImageOrientations getInitialOrientation() const
Get the initial image orientation.
Definition: ImageComponent.h:116
This Component manages a set of images, destined to be seen in a single orientation only (axial OR sa...
Definition: SingleImageComponent.h:56
Definition: Action.cpp:36
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:53
SingleImageComponent * axialSlices
the axial slices representation (all intelligence is delegated to a Slice class instance) ...
Definition: ImageComponent.h:278
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:298
vtkSmartPointer< vtkMatrix4x4 > rotationMatrix
The rotation matrix, that might have been altered by the user Will be saved in header file informatio...
Definition: ImageComponent.h:324
#define CAMITK_API
Definition: CamiTKAPI.h:49
ImageOrientationHelper::PossibleImageOrientations initialOrientation
Initial image orientation.
Definition: ImageComponent.h:309
The manager of the Image Volume data.
Definition: ImageComponent.h:73
PossibleImageOrientations
For each axis (x, y or z), 6 possibilities:
Definition: ImageOrientationHelper.h:52
const vtkSmartPointer< vtkMatrix4x4 > getRotationMatrix()
Definition: ImageComponent.h:208
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:314
SingleImageComponent * coronalSlices
the coronal slices representation (all intelligence is delegated to a Slice class instance) ...
Definition: ImageComponent.h:284
vtkSmartPointer< vtkImageData > originalImageData
the core Image Volume that is managed here
Definition: ImageComponent.h:275
vtkSmartPointer< vtkImageData > getImageData() const
get the image volume managed by this Component
Definition: ImageComponent.h:104
SingleImageComponent * arbitrarySlices
the arbitrary slices representation (all intelligence is delegated to a Slice class instance) ...
Definition: ImageComponent.h:287
void initRepresentation()
the concrete building of the 3D objects (Slice/Geometry): none in this case!
Definition: ImageComponent.h:252
vtkSmartPointer< vtkWindowLevelLookupTable > lut
the current lookup table
Definition: ImageComponent.h:294