vtk-dicom  0.8.14
vtkDICOMSliceSorter.h
1 /*=========================================================================
2 
3  Program: DICOM for VTK
4 
5  Copyright (c) 2012-2022 David Gobbi
6  All rights reserved.
7  See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef vtkDICOMSliceSorter_h
15 #define vtkDICOMSliceSorter_h
16 
17 #include "vtkObject.h"
18 #include "vtkDICOMModule.h" // For export macro
19 #include "vtkDICOMConfig.h" // For configuration details
20 #include "vtkDICOMTag.h" // For vtkDICOMTag
21 
22 // Declare VTK classes within VTK's optional namespace
23 #if defined(VTK_ABI_NAMESPACE_BEGIN)
24 VTK_ABI_NAMESPACE_BEGIN
25 #endif
26 
27 class vtkIntArray;
28 class vtkStringArray;
29 
30 #if defined(VTK_ABI_NAMESPACE_BEGIN)
31 VTK_ABI_NAMESPACE_END
32 #endif
33 
34 class vtkDICOMMetaData;
35 
37 
42 class VTKDICOM_EXPORT vtkDICOMSliceSorter : public vtkObject
43 {
44 public:
46  void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
47  static vtkDICOMSliceSorter *New();
48 
50 
56  void SetDesiredStackID(const char *stackId);
57  const char *GetDesiredStackID() { return this->DesiredStackID; }
58 
60 
63  vtkStringArray *GetStackIDs() { return this->StackIDs; }
65 
67 
77  vtkIntArray *GetFileIndexArray() { return this->FileIndexArray; }
78 
80 
86  vtkIntArray *GetFrameIndexArray() { return this->FrameIndexArray; }
88 
90 
99  vtkDICOMMetaData *GetMetaData() { return this->MetaData; }
101 
103 
111  vtkGetMacro(RepeatsAsTime, int);
112  vtkSetMacro(RepeatsAsTime, int);
113  vtkBooleanMacro(RepeatsAsTime, int);
115 
117 
125  vtkGetMacro(TimeAsVector, int);
126  vtkSetMacro(TimeAsVector, int);
127  vtkBooleanMacro(TimeAsVector, int);
129 
131  int GetTimeDimension() { return this->TimeDimension; }
133  double GetTimeSpacing() { return this->TimeSpacing; }
135 
137  vtkSetMacro(DesiredTimeIndex, int);
139  vtkGetMacro(DesiredTimeIndex, int);
141 
143 
154  vtkDICOMTag GetTimeTag() { return this->TimeTag; }
156 
158 
170  vtkDICOMTag GetTimeSequence() { return this->TimeSequence; }
171 
173 
177  vtkGetMacro(ReverseSlices, int);
178  vtkSetMacro(ReverseSlices, int);
179  vtkBooleanMacro(ReverseSlices, int);
181 
183  double GetSliceSpacing() { return this->SliceSpacing; }
186 
188  void Update();
191 
192 protected:
194  ~vtkDICOMSliceSorter() VTK_DICOM_OVERRIDE;
195 
196  // Sort the input files, put the sort in the supplied arrays.
197  virtual void SortFiles(vtkIntArray *fileArray, vtkIntArray *frameArray);
198 
199  // The meta data for the image.
200  vtkDICOMMetaData *MetaData;
201 
202  // An array to convert slice indices to input files
203  vtkIntArray *FileIndexArray;
204 
205  // An array to convert slice indices to input frames
206  vtkIntArray *FrameIndexArray;
207 
208  // An array that holds the stack IDs.
209  vtkStringArray *StackIDs;
210 
211  // Time dimension variables.
212  int RepeatsAsTime;
213  int TimeAsVector;
214  int TimeDimension;
215  int DesiredTimeIndex;
216  double TimeSpacing;
217 
218  // The stack to load.
219  char DesiredStackID[20];
220 
221  // Whether to reverse the slice order.
222  int ReverseSlices;
223  double SliceSpacing;
224 
225  // The tags to use for time information.
226  vtkDICOMTag TimeTag;
227  vtkDICOMTag TimeSequence;
228 
229 private:
230 #ifdef VTK_DICOM_DELETE
231  vtkDICOMSliceSorter(const vtkDICOMSliceSorter&) VTK_DICOM_DELETE;
232  void operator=(const vtkDICOMSliceSorter&) VTK_DICOM_DELETE;
233 #else
234  vtkDICOMSliceSorter(const vtkDICOMSliceSorter&) = delete;
235  void operator=(const vtkDICOMSliceSorter&) = delete;
236 #endif
237 };
238 
239 #endif
A container class for DICOM metadata.
Definition: vtkDICOMMetaData.h:44
Index a DICOM series to allow proper dimensional ordering.
Definition: vtkDICOMSliceSorter.h:43
vtkStringArray * GetStackIDs()
Get a list of the stacks that are present.
Definition: vtkDICOMSliceSorter.h:63
void SetMetaData(vtkDICOMMetaData *meta)
Set the meta data for the DICOM files.
vtkIntArray * GetFrameIndexArray()
Get an array that converts slice index to frame index.
Definition: vtkDICOMSliceSorter.h:86
void SetDesiredStackID(const char *stackId)
Set the Stack ID of the stack to use, for named stacks.
void SetTimeTag(vtkDICOMTag tag)
Set the DICOM tag to use for time measurement.
void SetTimeSequence(vtkDICOMTag tag)
Set the DICOM sequence to use for timing information.
vtkIntArray * GetFileIndexArray()
Get an array that converts slice index to input file index.
Definition: vtkDICOMSliceSorter.h:77
void PrintSelf(ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
A (group,element) identifier tag for DICOM attributes.
Definition: vtkDICOMTag.h:23
abstract base class for most VTK objects
Definition: vtkObject.h:54
static vtkObject * New()