9 VolumeData::VolumeData(
EMData* em)
16 InitializeVolumeData(sizeX, sizeY, sizeZ, 1, 1, 1, 0, 0, 0,
true, 0);
20 InitializeVolumeData(sizeX, sizeY, sizeZ, 1, 1, 1, 0, 0, 0,
true, val);
24 InitializeVolumeData(sizeX, sizeY, sizeZ, data->
GetSpacingX(), data->
GetSpacingY(), data->
GetSpacingZ(), data->
GetOriginX(), data->
GetOriginY(), data->
GetOriginZ(),
false, 0);
26 for (
int k = offsetZ; k < sizeZ + offsetZ; k++) {
27 for (
int j = offsetY; j < sizeY + offsetY; j++ ) {
28 for (
int i = offsetX; i < sizeX + offsetX; i++) {
30 SetDataAt(i-offsetX,j-offsetY,k-offsetZ, value);
49 void VolumeData::InitializeVolumeData(
int sizeX,
int sizeY,
int sizeZ,
float spacingX,
float spacingY,
float spacingZ,
float originX,
float originY,
float originZ,
bool initializeData,
float val) {
79 return emdata->get_xsize();
83 return emdata->get_ysize();
87 return emdata->get_zsize();
108 return emdata->get_attr(
"apix_x");
112 return emdata->get_attr(
"apix_y");
116 return emdata->get_attr(
"apix_y");
137 return emdata->get_attr(
"origin_x");
141 return emdata->get_attr(
"origin_y");
145 return emdata->get_attr(
"origin_z");
150 return this->
emdata->get_value_at(x,
y, z);
155 return emdata->get_value_at(index);
172 emdata->set_attr(
"apix_x", spacingX);
173 emdata->set_attr(
"apix_y", spacingY);
174 emdata->set_attr(
"apix_z", spacingZ);
178 emdata->set_attr(
"origin_x", originX);
179 emdata->set_attr(
"origin_y", originY);
180 emdata->set_attr(
"origin_z", originZ);
185 emdata->set_size(sizeX, sizeY, sizeZ);
189 emdata->set_value_at(
x,
y, z, value);
194 emdata->get_data()[index] = value;
201 int newSizeX = sizex + 2*padBy;
202 int newSizeY = sizey + 2*padBy;
203 int newSizeZ = sizez + 2*padBy;
221 float * newData = (
float*) malloc ( newSizeX * newSizeY * newSizeZ *
sizeof(
float) );
224 for(
int z = 0; z < newSizeZ; z++) {
225 for(
int y = 0;
y < newSizeY;
y++) {
226 for(
int x = 0;
x < newSizeX;
x++) {
227 if ((
x < padBy) || (
y < padBy) || (z < padBy) || (
x >= padBy + sizex) || (
y >= padBy + sizey) || (z >= padBy + sizez)) {
233 newData[
x +
y * newSizeX + z * newSizeX * newSizeY] =
static_cast<float>(value);
238 SetSize(newSizeX, newSizeY, newSizeZ);
239 emdata->set_data(newData, newSizeX, newSizeY, newSizeZ);
EMData stores an image's data and defines core image processing routines.
void InitializeVolumeData(int sizeX, int sizeY, int sizeZ, float spacingX, float spacingY, float spacingZ, float originX, float originY, float originZ, bool initializeData, float val)
void SetOrigin(float originX, float originY, float originZ)
float GetSpacing(int dimension)
void SetSpacing(float spacingX, float spacingY, float spacingZ)
void Pad(int padBy, double padValue)
float GetOrigin(int dimension)
void SetDataAt(int x, int y, int z, float value)
void SetSize(int sizeX, int sizeY, int sizeZ)
float GetDataAt(int x, int y, int z)
int GetSize(int dimension)
int GetIndex(int x, int y, int z)
#define InvalidParameterException(desc)