5 #include "MetaDataContainer.h"
57 int _width, _height, _depth;
58 double _spacingX, _spacingY, _spacingZ;
66 Grid3(
int width,
int height,
int depth=1,
double x_spacing=1.0,
double y_spacing=1.0,
double z_spacing=1.0);
72 void Init(
int width,
int height,
int depth=1,
double x_spacing=1.0,
double y_spacing=1.0,
double z_spacing=1.0);
99 void SetSpacing(
double x_spacing,
double y_spacing,
double z_spacing);
102 void SetSpacing(
Vec3d spacing);
118 int NumberOfElements();
124 std::string GetDataType();
127 int Offset(
int x,
int y,
int z);
133 Vec3i Coordinate(
long index);
136 bool IsInside(
int x,
int y,
int z);
139 bool IsInside(
Vec3i p);
142 T& operator[](
long index);
145 T& operator()(
int x,
int y,
int z=0,
bool Safe=
false);
148 T& operator()(
Vec3i p,
bool Safe=
false);
151 T LinearAt(
double x,
double y,
double z);
157 void Get6Neighbors(
long index, vector<long>& n);
160 void Get6Neighbors(
Vec3i p, vector<Vec3i>& n);
191 bool CreateFromFile(std::string filename);
194 bool ReadVTK(std::string filename);
197 bool WriteVTK(std::string filename);
208 bool ReadMetaImage(std::string filename);
211 bool WriteMetaImage(std::string filename);
214 bool ReadNIFTI(std::string filename);
217 bool WriteNIFTI(std::string filename);
220 bool ReadDICOM(std::string filename);
int GetHeight()
Return the number of grid rows.
Definition: Grid3.h:78
int GetWidth()
Return the number of grid columns.
Definition: Grid3.h:75
Class representing 3D vectors, with elements of type T.
Definition: Vector3.h:9
Grid3()
Default constructor.
Definition: Grid3.h:63
MetaDataContainer GetMetaData()
Returns a MetaDataContainer with the current image meta data.
Definition: Grid3.h:112
Class representing a 3D image grid, each voxel being of type T.
Definition: Grid3.h:53
int Offset(Vec3i p)
Returns the index of a specified coordinate in the internal data array.
Definition: Grid3.h:130
Vec3i GetDimensions()
Return a vector containing the grid dimensions.
Definition: Grid3.h:84
double GetSpacingZ()
Return the spacing along Z.
Definition: Grid3.h:93
Vec3d GetSpacing()
Return the spacing along all three dimesions.
Definition: Grid3.h:96
void SetMetaData(MetaDataContainer md)
Set image meta data. All current meta data is overwritten.
Definition: Grid3.h:115
double GetSpacingX()
Return the spacing along X.
Definition: Grid3.h:87
int GetDepth()
Return the number of grid slices.
Definition: Grid3.h:81
double GetSpacingY()
Return the spacing along Y.
Definition: Grid3.h:90