Computer Assisted Medical Intervention Tool Kit  version 5.2
Slice.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
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 CANONICAL_SLICE_H
27 #define CANONICAL_SLICE_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 #include "InterfaceBitMap.h"
32 
33 // -- vtk stuff
34 // disable warning generated by clang about the surrounded headers
35 #include <CamiTKDisableWarnings>
36 #include <vtkWindowLevelLookupTable.h>
37 #include <vtkActor.h>
38 #include <vtkImageActor.h>
39 #include <CamiTKReEnableWarnings>
40 
41 #include <vtkImageData.h>
42 #include <vtkTransform.h>
43 #include <vtkUnstructuredGrid.h>
44 #include <vtkImageReslice.h>
45 
46 namespace camitk {
127 public:
156  ARBITRARY
157  };
158 
162  Slice(vtkSmartPointer<vtkImageData> volume, SliceOrientation AXIAL_ORIENTATION, vtkSmartPointer<vtkWindowLevelLookupTable> lookupTable = nullptr);
163 
165  ~Slice() override;
167 
170 
172  void setOriginalVolume(vtkSmartPointer<vtkImageData> img) override final;
173 
177  void setImageWorldTransform(vtkSmartPointer<vtkTransform>) override;
178 
180  vtkSmartPointer<vtkImageActor> get2DImageActor() const override;
181 
183  vtkSmartPointer<vtkImageActor> get3DImageActor() const override;
184 
186  vtkSmartPointer<vtkActor> getPickPlaneActor() const override;
187 
189  vtkSmartPointer<vtkActor> getPixelActor() override;
190 
194  void pixelPicked(double, double, double) override;
195 
197  void updatePickPlane() override final;
198 
200  int getNumberOfSlices() const override final;
201 
203  int getSlice() const override;
204 
209  void setSlice(int s) override final;
210 
212  void setSlice(double x, double y, double z) override;
213 
217  int getNumberOfColors() const override;
218 
220  void setPixelRealPosition(double, double, double) override;
221 
228  virtual void setArbitraryTransform(vtkSmartPointer<vtkTransform>) override;
229 
231  vtkSmartPointer<vtkImageData> getImageData() const override;
232 
233  // @}
234 
244 
246  vtkSmartPointer<vtkProp> getProp(const QString&) override;
247 
249  unsigned int getNumberOfProp() const override;
250 
252  vtkSmartPointer<vtkProp> getProp(unsigned int) override;
253 
257  bool addProp(const QString&, vtkSmartPointer<vtkProp>) override;
258 
262  bool removeProp(const QString&) override;
263 
265 
266 
267 protected:
268 
271 
273  void init();
274 
276  void initActors();
277 
282  void reslicedToVolumeCoords(const double* ijk, double* xyz);
283 
287  void volumeToReslicedCoords(const double* xyz, double* ijk);
289 
292 
294  SliceOrientation sliceOrientation;
295 
297  vtkSmartPointer<vtkImageData> originalVolume;
298 
300  int currentSliceIndex;
301 
303  vtkSmartPointer<vtkWindowLevelLookupTable> lut;
304 
306  double originalSpacing[3];
307 
309  double originalSize[3];
310 
312  vtkSmartPointer<vtkImageActor> image3DActor;
313 
315  vtkSmartPointer<vtkImageActor> image2DActor;
317 
320 
322  vtkSmartPointer<vtkImageReslice> image2DReslicer;
323 
325 
328 
330  void initPickPlaneActor();
331 
335  void initPixelActor();
336 
347  void updatePixelActor(double x, double y, double z);
348 
350  void updatePixelActor();
351 
353  vtkSmartPointer<vtkActor> pickPlaneActor;
354 
356  vtkSmartPointer<vtkUnstructuredGrid> pickPlaneActorPointSet;
357 
359  vtkSmartPointer<vtkActor> pixelActor;
360 
362  vtkSmartPointer<vtkUnstructuredGrid> pixelActorPointSet;
364 
368 
370  QMap<QString, vtkSmartPointer<vtkProp> > extraProp;
371 
373 };
374 
375 }
376 
377 #endif // CANONICAL_SLICE_H
378 
#define CAMITK_API
Definition: CamiTKAPI.h:49
This class describes what are the methods to implement for a BitMap.
Definition: InterfaceBitMap.h:68
Display a slice (i.e.
Definition: Slice.h:126
SliceOrientation
Common slices orientation: axial, sagittal, coronal axial_neuro.
Definition: Slice.h:151
@ AXIAL
Definition: Slice.h:152
@ AXIAL_NEURO
Definition: Slice.h:155
@ CORONAL
Definition: Slice.h:153
@ SAGITTAL
Definition: Slice.h:154
Definition: Action.cpp:36
void removeProp(vtkSmartPointer< vtkProp > p, bool refresh=false)
remove the given vtkProp (e.g.
addProp(axes)