Computer Assited Medical Intervention Tool Kit  version 3.3
 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-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 
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 
67 class MeshComponent;
68 
70  Q_OBJECT
71 
73  Q_PROPERTY(QString imageName READ getImageName WRITE setImageName)
74 
75 
76  Q_PROPERTY(QVariantMap imageSize READ getImageSize)
77 
79  Q_PROPERTY(QVector3D voxelSize READ getVoxelSize)
80 
82  Q_PROPERTY(QVector3D origin READ getImageOrigin)
83 
85  Q_PROPERTY(QString imageType READ getDataType)
86 
88  Q_PROPERTY(bool viewIn3D READ getViewIn3D WRITE setViewIn3D);
89 
90 
91 public:
92 
118  LPS_Z
119  };
120 
122  ImageComponent(const QString & file) throw(AbortException) ;
123 
131  ImageComponent(vtkSmartPointer<vtkImageData> anImageData, const QString &name, bool copy=false)
132  throw(AbortException) ;
133 
135  ~ImageComponent();
136 
138  virtual void setSelected(const bool b, const bool recursive=false);
139 
141  QString getImageName() const;
142  void setImageName(const QString& );
143 
145  vtkSmartPointer<vtkImageData> getImageData();
146 
151  void pixelPicked(double x, double y, double z, SingleImageComponent *whoIsAsking);
152 
154  void getLastPixelPicked( int * x, int * y, int * z );
155 
160  int getNumberOfColors() const;
161 
163  double getMinColor() const;
164 
166  double getMaxColor() const;
167 
169  int getNumberOfSlices() const;
170 
172  virtual void setLut(vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable);
173 
175  virtual vtkSmartPointer<vtkWindowLevelLookupTable> getLut();
176 
179  virtual void refresh() const;
180 
182  SingleImageComponent * getAxialSlices();
184  SingleImageComponent * getCoronalSlices();
186  SingleImageComponent * getSagittalSlices();
188  SingleImageComponent * getArbitrarySlices();
190  MeshComponent * getVolumeRenderingChild();
191 
196  virtual void replaceImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy=false);
197 
199  QVariantMap getImageSize() const;
200  QString getDataType() const;
201  QVector3D getVoxelSize() const;
202  QVector3D getImageOrigin() const;
203  bool getViewIn3D() const;
204  void setViewIn3D(bool);
205 
206 protected:
207 
208  virtual void setImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy);
209 
210 private:
211 
213  virtual void initRepresentation() {};
214 
215  // builds default lookup table
216  void initLookupTable();
217 
219  void buildImageComponents();
220 
221  void updateImageComponents();
222 
225  vtkSmartPointer<vtkPolyData> getBoundingBox();
226 
227 private:
229 
230  vtkSmartPointer<vtkImageData> originalImageData;
231 
236 
240 
242  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
243 
245  int currentPixelPicked[3];
246 
248  virtual void init();
249 
251  QString imageName;
252 
254  bool viewIn3D;
255 };
256 
257 // -------------------- getImageData --------------------
258 inline vtkSmartPointer<vtkImageData> ImageComponent::getImageData() {
259  return originalImageData;
260 }
261 
262 }
263 
264 #endif //IMAGE_COMPONENT_H
Right Posterior Superior _ Axial normal Y.
Definition: ImageComponent.h:115
SingleImageComponent * sagittalSlices
Definition: ImageComponent.h:233
Right Anterior Superior _ Axial normal X.
Definition: ImageComponent.h:108
Exception class to handle abortion in component instanciation.
Definition: AbortException.h:44
MeshComponent * volumeRenderingChild
When an action computes volume rendering for an image, it stores the corresponding actor as a prop of...
Definition: ImageComponent.h:239
Right Anterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:98
vtkSmartPointer< vtkImageData > getImageData()
get the image volume managed by this Component
Definition: ImageComponent.h:258
This Component manages a set of images, destined to be seen in a single orientation only (axial OR sa...
Definition: SingleImageComponent.h:56
Right Posterior Inferior _ Axial normal X.
Definition: ImageComponent.h:102
Left Anterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:100
Left Anterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:101
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:44
Left Posterior Inferior _ Axial normal X.
Definition: ImageComponent.h:105
Left Anterior Inferior _ Axial normal X.
Definition: ImageComponent.h:99
Right Posterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:103
Left Posterior Superior _ Axial normal X.
Definition: ImageComponent.h:117
Right Anterior Superior _ Axial normal Y.
Definition: ImageComponent.h:109
Left Anterior Superior _ Axial normal Y.
Definition: ImageComponent.h:112
Right Anterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:97
SingleImageComponent * axialSlices
Definition: ImageComponent.h:232
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:292
#define CAMITK_API
Definition: CamiTKAPI.h:49
Left Anterior Superior _ Axial normal Z.
Definition: ImageComponent.h:113
Definition: ImageComponent.h:69
Definition: ImageComponent.h:95
CamiTK CamiTKDir txt file(STRINGS"${FIND_CAMITK_USER_BASE_DIR}/CamiTK/CamiTKDir.txt"FIND_CAMITK_USER_DIR_LAST_INSTALL) endif() find_program(CAMITK_CONFIG_EXECUTABLE NAMES camitk-config-debug camitk-config PATH_SUFFIXES"bin"PATHS"$
Definition: FindCamiTK.cmake:80
Right Posterior Superior _ Axial normal X.
Definition: ImageComponent.h:114
Left Anterior Superior _ Axial normal X.
Definition: ImageComponent.h:111
Right Posterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:104
Right Anterior Inferior _ Axial normal X.
Definition: ImageComponent.h:96
Left Posterior Inferior _ Axial normal Z.
Definition: ImageComponent.h:107
Right Posterior Superior _ Axial normal Z.
Definition: ImageComponent.h:116
Right Anterior Superior _ Axial normal Z.
Definition: ImageComponent.h:110
SingleImageComponent * coronalSlices
Definition: ImageComponent.h:234
MedicalDataOrigin
: There is no convension concerning the origin of the data.
Definition: ImageComponent.h:94
vtkSmartPointer< vtkImageData > originalImageData
the core Image Volume that is managed here
Definition: ImageComponent.h:230
SingleImageComponent * arbitrarySlices
Definition: ImageComponent.h:235
vtkSmartPointer< vtkWindowLevelLookupTable > lut
the current lookup table
Definition: ImageComponent.h:242
Left Posterior Inferior _ Axial normal Y.
Definition: ImageComponent.h:106