Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

InterfaceBitMap.h 7.18 KB
Newer Older
1
/*****************************************************************************
2
3
4
 * $CAMITK_LICENCE_BEGIN$
 *
 * CamiTK - Computer Assisted Medical Intervention ToolKit
promayon's avatar
promayon committed
5
 * (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * Visit http://camitk.imag.fr for more information
 *
 * This file is part of CamiTK.
 *
 * CamiTK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * CamiTK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with CamiTK.  If not, see <http://www.gnu.org/licenses/>.
 *
 * $CAMITK_LICENCE_END$
 ****************************************************************************/
25
26
27
28
29
30

#ifndef INTERFACEBITMAP_H
#define INTERFACEBITMAP_H

// -- vtk stuff
#include <vtkSmartPointer.h>
31
32
33
#include <vtkProp.h>
#include <QMap>
#include <QString>
34
35
36
37

// -- vtk stuff Classes
class vtkImageActor;
class vtkActor;
38
class vtkAxesActor;
39
40
class vtkImageData;
class vtkWindowLevelLookupTable;
41
class vtkTransform;
42
43
44
45
46
47

namespace camitk
{
// -- Core stuff Classes
class Component;

48
49
50
51
52
/** 
 * @ingroup group_sdk_libraries_core_component
 * 
 * @brief 
 * This class describes what are the methods to implement
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 * for a BitMap.
 * An InterfaceBitMap is a kind of simplifier/wrapper for vtkImageData.
 *
 * This class defines an "interface" (in the OOP/java meaning of the term).
 * See the introduction of GoF: "Program to an interface, not an implementation."
 * To see what Erich Gamma has to say about it: http://www.artima.com/lejava/articles/designprinciplesP.html
 * To see what Bjarne Stroustrup has to say about it: http://www.artima.com/intv/modern.html
 *
 * @see Slice
 */

class InterfaceBitMap {

  public:

68
69
70
71
72
73
74
75
    /** @cond
     * TODO CAMITK_DEPRECATED. this enum option is deprecated. It will be removed in CamiTK 4.0
     * Deprecated.
     * Use SliceOrientation for Slice or ArbitrarySlice class instead.
     *
     * Common slices orientation: axial, sagittal, coronal or anything else.
     * The Image Component is supposed to be given in RAI orientation
     * (see Image Reorientation Action Documentation).
76
     *
77
     * AXIAL_ORIENTATION:     from feet  to head of the patient in case of RAI
78
     *
79
     * CORONAL_ORIENTATION:   from the front to back  of the patient
80
     *
81
     * SAGITTAL_ORIENTATION:  from the right to left of the patient
82
     *
83
     * Deprecated. Use ArbitrarySlice Class instead.
84
     * ARBITRARY_ORIENTATION: well give the orientation you want!
85
     * @endcond
86
87
88
89
90
91
92
93
94
95
96
97
98
     */
    enum PossibleOrientation {
      AXIAL_ORIENTATION,
      CORONAL_ORIENTATION,
      SAGITTAL_ORIENTATION,
      ARBITRARY_ORIENTATION
    };

    /// virtual destructor
    virtual ~InterfaceBitMap() {};

    /// set the original volume image data (the source vtkImageData before any reslice) and refresh the vtk pipeline
    virtual void setOriginalVolume(vtkSmartPointer<vtkImageData>) = 0;
99
100
101
    
    /// set the transformation for 3D image representation
    virtual void setImageWorldTransform(vtkSmartPointer<vtkTransform>)=0;
102

103
    /** Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D viewers. */
104
105
    virtual vtkSmartPointer<vtkImageActor> get2DImageActor() const = 0;

106
	/** Return the vtkImageActor (vtkProp) representing a slice to be displayed in 3D viewers. */
107
108
    virtual vtkSmartPointer<vtkImageActor> get3DImageActor() const = 0;

109
    /** Return the vtkActor used to pick pixels in the slices. */
110
111
112
113
114
    virtual vtkSmartPointer<vtkActor> getPickPlaneActor() const = 0;

    /** Return the vtkActor used to pick pixels in the slices. */
    virtual vtkSmartPointer<vtkActor> getPixelActor() = 0;

115
116
117
118
    /** Return 2D Axes at the proper slice origin */
//    virtual vtkSmartPointer<vtkAxesActor> get2DAxesActor() = 0;
    
    
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    /** This method is called when the associated plane has been picked in the InteractiveViewer,
     *  the given coordinates is position where the plane was picked.
     */
    virtual void pixelPicked(double, double, double) = 0;

    virtual void updatePickPlane() = 0;

    /** Return the number of slices in the image data set. */
    virtual int getNumberOfSlices() const = 0;

    /** Return the index of the current displayed slice. */
    virtual int getSlice() const = 0;

    /** Set the current slice index.
     * If the slice index is less than the first slice index, the first slice is displayed.
     * If the slice index is more than the last slice index, the last slice is displayed.
     * @param s the index of the slice to display (base 0). */
    virtual void setSlice(int s) = 0;

138
    /// Set the slice corresponding to the given image coordinates (in RAI convention)
139
140
    virtual void setSlice(double x, double y, double z) = 0;
    
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
    /** Return the number of colors in the images.
     * If color is coded on 1 byte, the images are on 256 grey level.
     * If color is coded on 2 bytes, the images are on 4096 grey level (not 65536). */
    virtual int getNumberOfColors() const = 0;

    /// move the pixel selection green indicator (pixelActor) to the given real position
    virtual void setPixelRealPosition(double, double, double) = 0;
	
    
    ///@cond
    // TODO CAMITK_DEPRECATED. This section list all the methods marked as deprecated. They are to be removed in CamiTK 4.0
    /** Deprecated.
     * Return the displayed images as a vtkImageData. */
    virtual vtkSmartPointer<vtkImageData> getImageData() const = 0;
    /** Deprecated. Should be implemented only on ArbitrarySlice.
     * Return the current angle applied to the arbitrary slice */
157
158
159
160
    virtual double getRotationX() const = 0;
    virtual double getRotationY() const = 0;
    virtual double getRotationZ() const = 0;
    
161
162
    /** Deprecated. Should be implemented only on ArbitrarySlice.
     * Set the current angle to the arbitrary slice */
163
164
165
    virtual void setRotationX(double angle) = 0;
    virtual void setRotationY(double angle) = 0;
    virtual void setRotationZ(double angle) = 0;
166
167
    ///@cond
    
168
169
    
    
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
	// TODO : put all of this into a dedicated interface
	/// The additional map for prop (include at least "label" and "glyph"
    QMap<QString, vtkSmartPointer<vtkProp> > extraProp;
	
	/// Return the vtkProp (actors, volumes and annotations) corresponding to the given name
    virtual vtkSmartPointer<vtkProp> getProp(const QString &) = 0;

    /// return the number of additional prop
    virtual unsigned int getNumberOfProp() const = 0;

    /// return an additional prop by its index
    virtual vtkSmartPointer<vtkProp> getProp(unsigned int) = 0;

    /** insert an additional prop, defining it by its name (default visibility = false)
     *  @return true if the additional prop was added (i.e. another additional prop of the same name does not exist)
     */
    virtual bool addProp(const QString &,  vtkSmartPointer<vtkProp>) = 0;
    
    /** remove a given additional prop.
     * @return true if effictively done
     */
    virtual bool removeProp(const QString &) = 0;
	// END TODO
193
194
195
196
197
198

};

}

#endif