forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvtkMetaImageWriter.h
123 lines (99 loc) · 3.84 KB
/
vtkMetaImageWriter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMetaImageWriter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkMetaImageWriter - write a binary UNC meta image data
// .SECTION Description
// One of the formats for which a reader is already available in the toolkit is
// the MetaImage file format. This is a fairly simple yet powerful format
// consisting of a text header and a binary data section. The following
// instructions describe how you can write a MetaImage header for the data that
// you download from the BrainWeb page.
//
// The minimal structure of the MetaImage header is the following:
//
// NDims = 3
// DimSize = 181 217 181
// ElementType = MET_UCHAR
// ElementSpacing = 1.0 1.0 1.0
// ElementByteOrderMSB = False
// ElementDataFile = brainweb1.raw
//
// * NDims indicate that this is a 3D image. ITK can handle images of
// arbitrary dimension.
// * DimSize indicates the size of the volume in pixels along each
// direction.
// * ElementType indicate the primitive type used for pixels. In this case
// is "unsigned char", implying that the data is digitized in 8 bits /
// pixel.
// * ElementSpacing indicates the physical separation between the center of
// one pixel and the center of the next pixel along each direction in space.
// The units used are millimeters.
// * ElementByteOrderMSB indicates is the data is encoded in little or big
// endian order. You might want to play with this value when moving data
// between different computer platforms.
// * ElementDataFile is the name of the file containing the raw binary data
// of the image. This file must be in the same directory as the header.
//
// MetaImage headers are expected to have extension: ".mha" or ".mhd"
//
// Once you write this header text file, it should be possible to read the
// image into your ITK based application using the itk::FileIOToImageFilter
// class.
// .SECTION Caveats
//
// .SECTION See Also
// vtkImageWriter vtkMetaImageReader
#ifndef __vtkMetaImageWriter_h
#define __vtkMetaImageWriter_h
#include "vtkImageWriter.h"
//BTX
namespace vtkmetaio { class MetaImage; } // forward declaration
//ETX
class VTK_IO_EXPORT vtkMetaImageWriter : public vtkImageWriter
{
public:
vtkTypeMacro(vtkMetaImageWriter,vtkImageWriter);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Construct object with FlipNormals turned off and Normals set to true.
static vtkMetaImageWriter *New();
// Description:
// Specify file name of meta file
virtual void SetFileName(const char* fname);
virtual char* GetFileName() { return this->MHDFileName; }
// Description:
// Specify the file name of the raw image data.
virtual void SetRAWFileName(const char* fname);
virtual char* GetRAWFileName();
virtual void SetCompression( bool compress )
{
this->Compress = compress;
}
virtual bool GetCompression( void )
{
return this->Compress;
}
// This is called by the superclass.
// This is the method you should override.
virtual void Write();
protected:
vtkMetaImageWriter();
~vtkMetaImageWriter();
vtkSetStringMacro(MHDFileName);
char* MHDFileName;
bool Compress;
private:
vtkMetaImageWriter(const vtkMetaImageWriter&); // Not implemented.
void operator=(const vtkMetaImageWriter&); // Not implemented.
//BTX
vtkmetaio::MetaImage * MetaImagePtr;
//ETX
};
#endif