vtk-dicom  0.8.17
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
vtkDICOMWriter.h
1 /*=========================================================================
2 
3  Program: DICOM for VTK
4 
5  Copyright (c) 2012-2024 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 =========================================================================*/
26 #ifndef vtkDICOMWriter_h
27 #define vtkDICOMWriter_h
28 
29 #include "vtkImageWriter.h"
30 #include "vtkDICOMModule.h" // For export macro
31 #include "vtkDICOMConfig.h" // For configuration details
32 
33 // Declare VTK classes within VTK's optional namespace
34 #if defined(VTK_ABI_NAMESPACE_BEGIN)
35 VTK_ABI_NAMESPACE_BEGIN
36 #endif
37 
38 class vtkMatrix4x4;
39 
40 #if defined(VTK_ABI_NAMESPACE_BEGIN)
41 VTK_ABI_NAMESPACE_END
42 #endif
43 
44 class vtkDICOMMetaData;
45 class vtkDICOMGenerator;
46 
47 class VTKDICOM_EXPORT vtkDICOMWriter : public vtkImageWriter
48 {
49 public:
51 
53  static vtkDICOMWriter *New();
54 
56  void PrintSelf(ostream& os, vtkIndent indent) VTK_DICOM_OVERRIDE;
57 
59 
63  vtkSetStringMacro(SeriesDescription);
64  vtkGetStringMacro(SeriesDescription);
66 
68 
76  vtkSetStringMacro(ImageType);
77  vtkGetStringMacro(ImageType);
79 
81 
88  vtkSetMacro(TimeAsVector, int);
89  vtkBooleanMacro(TimeAsVector, int);
90  vtkGetMacro(TimeAsVector, int);
92 
94 
102  vtkSetMacro(TimeDimension, int);
103  vtkGetMacro(TimeDimension, int);
104  vtkSetMacro(TimeSpacing, double);
105  vtkGetMacro(TimeSpacing, double);
107 
109 
116  vtkSetMacro(RescaleIntercept, double);
117  vtkGetMacro(RescaleIntercept, double);
118  vtkSetMacro(RescaleSlope, double);
119  vtkGetMacro(RescaleSlope, double);
121 
123 
128  void SetPatientMatrix(vtkMatrix4x4 *);
129  vtkMatrix4x4 *GetPatientMatrix() { return this->PatientMatrix; }
131 
133  enum RowOrder { FileNative, TopDown, BottomUp };
134 
136 
142  void SetMemoryRowOrder(int order);
143  void SetMemoryRowOrderToFileNative() {
144  this->SetMemoryRowOrder(FileNative); }
145  void SetMemoryRowOrderToTopDown() {
146  this->SetMemoryRowOrder(TopDown); }
147  void SetMemoryRowOrderToBottomUp() {
148  this->SetMemoryRowOrder(BottomUp); }
149  int GetMemoryRowOrder() { return this->MemoryRowOrder; }
150  const char *GetMemoryRowOrderAsString();
152 
154  enum SliceOrder { RHR, LHR, Same, Reverse };
155 
157 
165  void SetFileSliceOrder(int order);
166  void SetFileSliceOrderToRHR() { this->SetFileSliceOrder(RHR); }
167  void SetFileSliceOrderToLHR() { this->SetFileSliceOrder(LHR); }
168  void SetFileSliceOrderToSame() { this->SetFileSliceOrder(Same); }
169  void SetFileSliceOrderToReverse() { this->SetFileSliceOrder(Reverse); }
170  int GetFileSliceOrder() { return this->FileSliceOrder; }
171  const char *GetFileSliceOrderAsString();
173 
175 
181  vtkDICOMMetaData *GetMetaData();
183 
185 
194  vtkDICOMGenerator *GetGenerator() { return this->Generator; }
196 
198 
204  vtkSetStringMacro(TransferSyntaxUID);
205  vtkGetStringMacro(TransferSyntaxUID);
207 
209 
216  vtkSetMacro(Streaming, int);
217  vtkGetMacro(Streaming, int);
218  vtkBooleanMacro(Streaming, int);
220 
222  void SetOverlayInputData(vtkImageData *data);
224  void SetOverlayInputConnection(vtkAlgorithmOutput *data);
225  vtkImageData *GetOverlayInput();
227 
229  vtkSetMacro(OverlayType, int);
231  vtkGetMacro(OverlayType, int);
232  void SetOverlayTypeToGraphics() { this->SetOverlayType(0); }
233  void SetOverlayTypeToROI() { this->SetOverlayType(1); }
235 
237  void Write() VTK_DICOM_OVERRIDE;
240 
241 protected:
242  vtkDICOMWriter();
243  ~vtkDICOMWriter() VTK_DICOM_OVERRIDE;
244 
246  void ComputeInternalFileName(int slice);
247 
249  void FreeInternalFileName();
250 
252  virtual int GenerateMetaData(vtkInformation *info);
253 
255  virtual void GenerateOverlays(int minFileIdx, int maxFileIdx,
256  const int extent[4]);
257 
259  int FillInputPortInformation(int port, vtkInformation *info) VTK_DICOM_OVERRIDE;
260 
261  int RequestData(vtkInformation *request,
262  vtkInformationVector** inputVector,
263  vtkInformationVector* outputVector) VTK_DICOM_OVERRIDE;
264 
266  vtkDICOMMetaData *MetaData;
267 
269  vtkDICOMMetaData *GeneratedMetaData;
270 
272  vtkDICOMGenerator *Generator;
273 
275  int TimeAsVector;
276 
278  int TimeDimension;
279  double TimeSpacing;
280 
282  double RescaleIntercept;
283  double RescaleSlope;
284 
286  vtkMatrix4x4 *PatientMatrix;
287 
289  char *SeriesDescription;
290 
292  char *TransferSyntaxUID;
293 
295  char *ImageType;
296 
298  int OverlayType;
299 
301  int MemoryRowOrder;
302 
304  int FileSliceOrder;
305 
307  int Streaming;
308 
309 private:
310 #ifdef VTK_DICOM_DELETE
311  vtkDICOMWriter(const vtkDICOMWriter&) VTK_DICOM_DELETE;
312  void operator=(const vtkDICOMWriter&) VTK_DICOM_DELETE;
313 #else
314  vtkDICOMWriter(const vtkDICOMWriter&) = delete;
315  void operator=(const vtkDICOMWriter&) = delete;
316 #endif
317 };
318 
319 #endif // vtkDICOMWriter_h
Generate DICOM data series for specific IOD classes.
Definition: vtkDICOMGenerator.h:56
A container class for DICOM metadata.
Definition: vtkDICOMMetaData.h:44
Write DICOM image files.
Definition: vtkDICOMWriter.h:48
static vtkDICOMWriter * New()
Static method for construction.
RowOrder
Enumeration for top-down vs. bottom-up ordering.
Definition: vtkDICOMWriter.h:133
void SetFileSliceOrder(int order)
Set the slice ordering of the files to be written.
void SetGenerator(vtkDICOMGenerator *)
Set the generator for image modality you wish to write.
void SetPatientMatrix(vtkMatrix4x4 *)
Set the matrix that places the image in DICOM patient coords.
void SetMetaData(vtkDICOMMetaData *)
Set the meta data to include with the file.
void SetMemoryRowOrder(int order)
Set the ordering of the image rows in memory.
void PrintSelf(ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
Print information about this object.
SliceOrder
Enumeration for file order.
Definition: vtkDICOMWriter.h:154
Writes images to files.
Definition: vtkImageWriter.h:33
virtual void Write()