Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 IMAGEVOLUMEMANAGERCOMPONENT_H
27 #define IMAGEVOLUMEMANAGERCOMPONENT_H
28 
29 // -- Core image component stuff
30 #include "SingleImageComponent.h"
31 #include "CamiTKAPI.h"
32 
33 // -- vtk stuff
34 #include <vtkSmartPointer.h>
35 #include <vtkImageData.h>
36 #include <vtkTransform.h>
37 #include <vtkImageFlip.h>
38 #include <vtkWindowLevelLookupTable.h>
39 
40 // -- QT stuff classes
41 class QMenu;
42 #include <QVector3D>
43 #include <QVariant>
44 
45 namespace camitk
46 {
47 
64  Q_OBJECT
65 
67  Q_PROPERTY(QString imageName READ getImageName WRITE setImageName)
68 
69 
70  Q_PROPERTY(QVariantMap imageSize READ getImageSize)
71 
73  Q_PROPERTY(QVector3D voxelSize READ getVoxelSize)
74 
76  Q_PROPERTY(QVector3D origin READ getImageOrigin)
77 
79  Q_PROPERTY(bool viewIn3D READ getViewIn3D WRITE setViewIn3D)
80 
81 
82 public:
83 
109  LPS_Z
110  };
111 
113  ImageComponent(const QString & file) throw(AbortException) ;
114 
123  ImageComponent(vtkSmartPointer<vtkImageData> anImageData, const QString &name, bool copy=false)
124  throw(AbortException) ;
125 
127  ~ImageComponent();
128 
130  virtual void setSelected(const bool b, const bool recursive=false);
131 
133  QString getImageName() const;
134  void setImageName(const QString& );
135 
137  vtkSmartPointer<vtkImageData> getImageData();
138 
143  void pixelPicked(double x, double y, double z, SingleImageComponent *whoIsAsking);
144 
146  void getLastPixelPicked( int * x, int * y, int * z );
147 
152  int getNumberOfColors() const;
153 
155  double getMinColor() const;
156 
158  double getMaxColor() const;
159 
161  int getNumberOfSlices() const;
162 
164  virtual void setLut(vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable);
165 
167  virtual vtkSmartPointer<vtkWindowLevelLookupTable> getLut();
168 
170 // void setAllVisibleIn3D(bool );
171 
174  virtual void refresh() const;
175 
177  SingleImageComponent * getAxialSlices();
179  SingleImageComponent * getCoronalSlices();
181  SingleImageComponent * getSagittalSlices();
183  SingleImageComponent * getArbitrarySlices();
184 
189  virtual void replaceImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy=false);
190 
192  QVariantMap getImageSize() const;
193  QVector3D getVoxelSize() const;
194  QVector3D getImageOrigin() const;
195  bool getViewIn3D() const;
196  void setViewIn3D(bool);
197 protected:
198 
199  virtual void setImageData(vtkSmartPointer<vtkImageData> anImageData, bool copy);
200 
201 private:
202 
204  virtual void initRepresentation() {};
205 
206  // builds default lookup table
207  void initLookupTable();
208 
210  void buildImageComponents();
211 
212  void updateImageComponents();
213 
214 private:
216 
217  vtkSmartPointer<vtkImageData> originalImageData;
218 
223 
225  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
226 
228  int currentPixelPicked[3];
229 
231  virtual void init();
232 
234  QString imageName;
235 
237  bool viewIn3D;
238 };
239 
240 // -------------------- getImageData --------------------
241 inline vtkSmartPointer<vtkImageData> ImageComponent::getImageData() {
242  return originalImageData;
243 }
244 
245 }
246 
247 #endif