70 Grid3(
int width,
int height,
int depth=1,
double x_spacing=1.0,
double y_spacing=1.0,
double z_spacing=1.0);
76 void Init(
int width,
int height,
int depth=1,
double x_spacing=1.0,
double y_spacing=1.0,
double z_spacing=1.0);
103 void SetSpacing(
double x_spacing,
double y_spacing,
double z_spacing);
106 void SetSpacing(
Vec3d spacing);
122 int NumberOfElements();
128 std::string GetDataType();
131 int Offset(
int x,
int y,
int z);
137 Vec3i Coordinate(
long index);
140 bool IsInside(
int x,
int y,
int z);
143 bool IsInside(
Vec3i p);
149 T& operator[](
long index);
164 void Get6Neighbors(
long index, vector<long>& n);
167 void Get6Neighbors(
Vec3i p, vector<Vec3i>& n);
198 bool CreateFromFile(std::string filename);
201 bool ReadVTK(std::string filename);
204 bool WriteVTK(std::string filename);
215 bool ReadMetaImage(std::string filename);
218 bool WriteMetaImage(std::string filename);
221 bool ReadNIFTI(std::string filename);
224 bool WriteNIFTI(std::string filename);
227 bool ReadDICOM(std::string filename);
T background_value
Definition: Grid3.h:60
BoundaryMode
Options for reading grid data outside the grid bounds.
Definition: Grid3.h:51
std::vector< T > data
Definition: Grid3.h:59
double _spacingZ
Definition: Grid3.h:62
T z
Definition: Vector3.h:13
int GetHeight()
Return the number of grid rows.
Definition: Grid3.h:82
int GetWidth()
Return the number of grid columns.
Definition: Grid3.h:79
Class representing 3D vectors, with elements of type T.
Definition: Vector3.h:9
MetaDataContainer metadata
Definition: Grid3.h:63
Grid3()
Default constructor.
Definition: Grid3.h:67
MetaDataContainer GetMetaData()
Returns a MetaDataContainer with the current image meta data.
Definition: Grid3.h:116
Vec3< int > Vec3i
Definition: Vector3.h:150
T x
Definition: Vector3.h:11
int _width
Definition: Grid3.h:61
Class representing a 3D image grid, each voxel being of type T.
Definition: Grid3.h:56
int Offset(Vec3i p)
Returns the index of a specified coordinate in the internal data array.
Definition: Grid3.h:134
Vec3i GetDimensions()
Return a vector containing the grid dimensions.
Definition: Grid3.h:88
double GetSpacingZ()
Return the spacing along Z.
Definition: Grid3.h:97
Vec3d GetSpacing()
Return the spacing along all three dimesions.
Definition: Grid3.h:100
void SetMetaData(MetaDataContainer md)
Set image meta data. All current meta data is overwritten.
Definition: Grid3.h:119
Vec3< double > Vec3d
Definition: Vector3.h:149
T y
Definition: Vector3.h:12
double GetSpacingX()
Return the spacing along X.
Definition: Grid3.h:91
int GetDepth()
Return the number of grid slices.
Definition: Grid3.h:85
double GetSpacingY()
Return the spacing along Y.
Definition: Grid3.h:94