17 #include <dtkCoreSupport/dtkGlobal.h>
18 #include <dtkCoreSupport/dtkAbstractData_p.h>
20 #include <vtkSmartPointer.h>
21 #include <vtkImageData.h>
27 class axlVolumeDiscretePrivate
34 double min_field_value;
35 double mid_field_value;
36 double max_field_value;
52 d->grid = vtkImageData::New();
54 d->min_field_value = d->grid->GetScalarTypeMax();
55 d->max_field_value = d->grid->GetScalarTypeMin();
57 this->setObjectName(
"axlVolumeDiscrete");
65 vtkImageData *grid =
static_cast<vtkImageData *
>(other.
data());
67 d->grid->DeepCopy(grid);
69 d->grid = vtkSmartPointer<vtkImageData>::New();
73 d->min_field_value = other.
minValue();
74 d->max_field_value = other.
maxValue();
75 d->mid_field_value = other.
midValue();
76 this->setObjectName(
"axlVolumeDiscrete");
91 vtkImageData *grid =
static_cast<vtkImageData *
>(other.
data());
93 d->grid = vtkSmartPointer<vtkImageData>::New();
97 d->grid->DeepCopy(grid);
104 return "axlVolumeDiscrete";
109 if(vtkImageData *grid = static_cast<vtkImageData *>(data)){
111 d->grid->DeepCopy(grid);
113 d->grid = vtkSmartPointer<vtkImageData>::New();
134 return d->grid->GetDimensions()[0];
144 return d->grid->GetDimensions()[1];
154 return d->grid->GetDimensions()[2];
159 d->grid->Initialize();
160 d->grid->SetExtent(0,x-1,0,y-1,0,z-1);
161 d->grid->SetOrigin(-0.5*x, -0.5*y, -0.5*z);
188 return d->min_field_value;
195 return d->mid_field_value;
214 return d->max_field_value;
219 d->min_field_value = min_field_value;
226 d->mid_field_value = mid_field_value;
232 d->max_field_value = max_field_value;
241 return d->grid->GetScalarComponentAsDouble(i,j,k,0);
250 d->grid->SetScalarComponentFromDouble(i,j,k,0, value);
254 d->max_field_value = value;
257 d->min_field_value = value;
double getValue(int i, int j, int k) const
axlVolumeDiscrete & operator=(const axlVolumeDiscrete &other)
double maxValue(void) const
void setMinValue(double min_field_value)
double minValue(void) const
int yDimension(void) const
void setValue(double value, int i, int j, int k)
int xDimension(void) const
int zDimension(void) const
void setDimensions(unsigned int x, unsigned int y, unsigned int z)
QString identifier(void) const
axlVolumeDiscrete * clone(void) const
dtkAbstractData * createaxlVolumeDiscrete(void)
void setMidValue(double mid_field_value)
void setMaxValue(double max_field_value)
double midValue(void) const