Computer Assited Medical Intervention Tool Kit  version 3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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-2013 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 
33 // -- vtk stuff
34 #include <vtkPolyData.h>
35 #include <vtkSmartPointer.h>
36 #include <vtkImageData.h>
37 #include <vtkTransform.h>
38 #include <vtkImageFlip.h>
39 #include <vtkWindowLevelLookupTable.h>
40 
41 // -- QT stuff classes
42 class QMenu;
43 #include <QVector3D>
44 #include <QVariant>
45 
46 namespace camitk {
47 
64 class MeshComponent;
65 
67  Q_OBJECT
68 
70  Q_PROPERTY(QString imageName READ getImageName WRITE setImageName)
71 
72 
73  Q_PROPERTY(QVariantMap imageSize READ getImageSize)
74 
76  Q_PROPERTY(QVector3D voxelSize READ getVoxelSize)
77 
79  Q_PROPERTY(QVector3D origin READ getImageOrigin)
80 
82  Q_PROPERTY(bool viewIn3D READ getViewIn3D WRITE setViewIn3D);
83 
84 
85 public:
86 
112  LPS_Z
113  };
114 
116  ImageComponent(const QString & file) throw(AbortException) ;
117 
125  ImageComponent(vtkSmartPointer<vtkImageData> anImageData, const QString &name, bool copy=false)
126  throw(AbortException) ;
127 
129  ~ImageComponent();
130 
132  virtual void setSelected(const bool b, const bool recursive=false);
133 
135  QString getImageName() const;
136  void setImageName(const QString& );
137 
139  vtkSmartPointer<vtkImageData> getImageData();
140 
145  void pixelPicked(double x, double y, double z, SingleImageComponent *whoIsAsking);
146 
148  void getLastPixelPicked( int * x, int * y, int * z );
149 
154  int getNumberOfColors() const;
155 
157  double getMinColor() const;
158 
160  double getMaxColor() const;
161 
163  int getNumberOfSlices() const;
164 
166  virtual void setLut(vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable);
167 
169  virtual vtkSmartPointer<vtkWindowLevelLookupTable> getLut();
170 
173  virtual void refresh() const;
174 
176  SingleImageComponent * getAxialSlices();
178  SingleImageComponent * getCoronalSlices();
180  SingleImageComponent * getSagittalSlices();
182  SingleImageComponent * getArbitrarySlices();
184  MeshComponent * getVolumeRenderingChild();
185 
190  virtual void replaceImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy=false);
191 
193  QVariantMap getImageSize() const;
194  QVector3D getVoxelSize() const;
195  QVector3D getImageOrigin() const;
196  bool getViewIn3D() const;
197  void setViewIn3D(bool);
198 
199 protected:
200 
201  virtual void setImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy);
202 
203 private:
204 
206  virtual void initRepresentation() {};
207 
208  // builds default lookup table
209  void initLookupTable();
210 
212  void buildImageComponents();
213 
214  void updateImageComponents();
215 
218  vtkSmartPointer<vtkPolyData> getBoundingBox();
219 
220 private:
222 
223  vtkSmartPointer<vtkImageData> originalImageData;
224 
229 
233 
235  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
236 
238  int currentPixelPicked[3];
239 
241  virtual void init();
242 
244  QString imageName;
245 
247  bool viewIn3D;
248 };
249 
250 // -------------------- getImageData --------------------
251 inline vtkSmartPointer<vtkImageData> ImageComponent::getImageData() {
252  return originalImageData;
253 }
254 
255 }
256 
257 #endif //IMAGE_COMPONENT_H
Right Posterior Superior _ Axial normal Y.
Definition: ImageComponent.h:109
SingleImageComponent * sagittalSlices
Definition: ImageComponent.h:226
Right Anterior Superior _ Axial normal X.
Definition: ImageComponent.h:102
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:40
MeshComponent * volumeRenderingChild
When an action computes volume rendering for an image, it stores the corresponding actor as a prop of...
Definition: ImageComponent.h:232
Right Anterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:92
vtkSmartPointer< vtkImageData > getImageData()
get the image volume managed by this Component
Definition: ImageComponent.h:251
This Component manages a set of images, destined to be seen in a single orientation only (axial OR sa...
Definition: SingleImageComponent.h:53
Right Posterior Inferior _ Axial normal X.
Definition: ImageComponent.h:96
Left Anterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:94
Left Anterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:95
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:40
Left Posterior Inferior _ Axial normal X.
Definition: ImageComponent.h:99
Left Anterior Inferior _ Axial normal X.
Definition: ImageComponent.h:93
Right Posterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:97
Left Posterior Superior _ Axial normal X.
Definition: ImageComponent.h:111
Right Anterior Superior _ Axial normal Y.
Definition: ImageComponent.h:103
Left Anterior Superior _ Axial normal Y.
Definition: ImageComponent.h:106
Right Anterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:91
SingleImageComponent * axialSlices
Definition: ImageComponent.h:225
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: Component.h:287
#define CAMITK_API
Definition: CamiTKAPI.h:49
Left Anterior Superior _ Axial normal Z.
Definition: ImageComponent.h:107
Definition: ImageComponent.h:66
Definition: ImageComponent.h:89
Right Posterior Superior _ Axial normal X.
Definition: ImageComponent.h:108
Left Anterior Superior _ Axial normal X.
Definition: ImageComponent.h:105
Right Posterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:98
Right Anterior Inferior _ Axial normal X.
Definition: ImageComponent.h:90
Left Posterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:101
Right Posterior Superior _ Axial normal Z.
Definition: ImageComponent.h:110
Right Anterior Superior _ Axial normal Z.
Definition: ImageComponent.h:104
SingleImageComponent * coronalSlices
Definition: ImageComponent.h:227
MedicalDataOrigin
: There is no convension concerning the origin of the data.
Definition: ImageComponent.h:88
vtkSmartPointer< vtkImageData > originalImageData
the core Image Volume that is managed here
Definition: ImageComponent.h:223
SingleImageComponent * arbitrarySlices
Definition: ImageComponent.h:228
vtkSmartPointer< vtkWindowLevelLookupTable > lut
the current lookup table
Definition: ImageComponent.h:235
Left Posterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:100