Computer Assited Medical Intervention Tool Kit  version 3.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2014 UJF-Grenoble 1, 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:
78  ImageComponent( const QString & file ) throw( AbortException ) ;
79 
88  ImageComponent( vtkSmartPointer<vtkImageData> anImageData, const QString &name, bool copy = false, ImageOrientationHelper::PossibleImageOrientations initialOrientation = ImageOrientationHelper::RAI )
89  throw( AbortException ) ;
90 
92  ~ImageComponent();
93 
95  virtual void setSelected( const bool b, const bool recursive = false );
96 
98  QString getImageName() const;
99  void setImageName( const QString& );
100 
102  vtkSmartPointer<vtkImageData> getImageData() const {
103  return originalImageData;
104  }
105 
108  return initialOrientation;
109  }
110 
114  void prepareForSaving();
115 
118  void postSaving();
119 
120 
125  void pixelPicked( double x, double y, double z, SingleImageComponent *whoIsAsking );
126 
129  void getLastPixelPicked( int * x, int * y, int * z );
130 
133  void getLastPointPickedImageCoords( double * x, double * y, double * z );
134 
137  void getLastPointPickedWorldCoords( double * x, double * y, double * z );
138 
139 
144  int getNumberOfColors() const;
145 
147  double getMinColor() const;
148 
150  double getMaxColor() const;
151 
155  int getActualNumberOfColors() const;
156 
158  double getActualMinColor() const;
159 
161  double getActualMaxColor() const;
162 
164  int getNumberOfSlices() const;
165 
167  virtual void setLut( vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable );
168 
170  virtual vtkSmartPointer<vtkWindowLevelLookupTable> getLut();
171 
174  virtual void refresh() const;
175 
177  SingleImageComponent * getAxialSlices();
179  SingleImageComponent * getCoronalSlices();
181  SingleImageComponent * getSagittalSlices();
183  SingleImageComponent * getArbitrarySlices();
185  MeshComponent * getVolumeRenderingChild();
186 
192  virtual void replaceImageData( vtkSmartPointer<vtkImageData> anImageData, bool copy = false, ImageOrientationHelper::PossibleImageOrientations initialOrientation = ImageOrientationHelper::RAI );
193 
195  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
199  QVariantMap getImageSize() const;
201  QString getDataType() const;
202  QVector3D getVoxelSize() const;
203  QVector3D getImageOrigin() const;
204  bool getViewIn3D() const;
205  void setViewIn3D( bool );
206  //@endcond
207 
208 
213  virtual void updateProperty( QString, QVariant );
216 
218  virtual unsigned int getNumberOfPropertyWidget();
219 
221  virtual QWidget * getPropertyWidgetAt( unsigned int i, QWidget* parent = 0 );
223 
224  const vtkSmartPointer<vtkMatrix4x4> getRotationMatrix() { return rotationMatrix; }
225 
226 protected:
227 
235  virtual void setImageData( vtkSmartPointer<vtkImageData> anImageData,
236  bool copy,
238  vtkSmartPointer<vtkMatrix4x4> initialTransformMatrix = NULL);
239 
250  virtual void updateImageProperties();
251 
252 private:
253 
255  virtual void initRepresentation() {}
256 
257  // builds default lookup table
258  void initLookupTable();
259 
261  void buildImageComponents();
262 
263  void updateImageComponents();
264 
267  vtkSmartPointer<vtkPolyData> getBoundingBox();
268 
270  vtkSmartPointer<vtkImageData> originalImageData;
271 
276 
280 
282  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
283 
285  double currentPixelPicked[3];
286 
288  virtual void init();
289 
291  // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
295  QString imageName;
297 
299  bool viewIn3D;
300 
301  //@endcond
302 
304  QTableView* selectionView;
305 
307  QStandardItemModel *model;
308 
311 
315  vtkSmartPointer<vtkTransform> initialImageDataTransform;
316 
321  vtkSmartPointer<vtkTransform> initialFrameTransform;
322 
325  vtkSmartPointer<vtkMatrix4x4> rotationMatrix;
326 };
327 
328 }
329 
330 #endif //IMAGE_COMPONENT_H
void init()
Definition: obj2pml.cpp:213
SingleImageComponent * sagittalSlices
Definition: ImageComponent.h:273
QTableView * selectionView
Tab displaying data selected point in the property explorer.
Definition: ImageComponent.h:304
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:43
ImageOrientationHelper::PossibleImageOrientations getInitialOrientation() const
Get the initial image orientation.
Definition: ImageComponent.h:107
vtkSmartPointer< vtkTransform > initialFrameTransform
The initial frame of the image at opening.
Definition: ImageComponent.h:321
QStandardItemModel * model
Model to display data.
Definition: ImageComponent.h:307
MeshComponent * volumeRenderingChild
When an action computes volume rendering for an image, it stores the corresponding actor as a prop of...
Definition: ImageComponent.h:279
vtkSmartPointer< vtkImageData > getImageData() const
get the image volume managed by this Component
Definition: ImageComponent.h:102
string name
Definition: select.cpp:111
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:48
virtual void initRepresentation()
the concrete building of the 3D objects (Slice/Geometry): none in this case!
Definition: ImageComponent.h:255
SingleImageComponent * axialSlices
Definition: ImageComponent.h:272
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:325
#define CAMITK_API
Definition: CamiTKAPI.h:49
ImageOrientationHelper::PossibleImageOrientations initialOrientation
Initial image orientation.
Definition: ImageComponent.h:310
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:224
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:315
SingleImageComponent * coronalSlices
Definition: ImageComponent.h:274
vtkSmartPointer< vtkImageData > originalImageData
the core Image Volume that is managed here
Definition: ImageComponent.h:270
SingleImageComponent * arbitrarySlices
Definition: ImageComponent.h:275
vtkSmartPointer< vtkWindowLevelLookupTable > lut
the current lookup table
Definition: ImageComponent.h:282