Skip to content
Snippets Groups Projects
Commit d3961503 authored by Alexis Girault's avatar Alexis Girault
Browse files

Add Direction support in vtkImageReader2

parent 2a080655
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ iren.SetRenderWindow(renWin)
# create pipeline
#
angle = pi/2
orientation = [
direction = [
-1, 0, 0,
0, cos(angle), -sin(angle),
0, -sin(angle), -cos(angle)
......@@ -35,7 +35,7 @@ reader.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
reader.SetDataExtent(0, 63, 0, 63, 1, 93)
reader.SetDataSpacing(3.2, 3.2, 1.5)
reader.SetDataOrigin(0.0, 0.0, 0.0)
reader.GetOutput().SetDirectionMatrix(orientation)
reader.SetDataDirection(direction)
iso = vtk.vtkImageMarchingCubes()
iso.SetInputConnection(reader.GetOutputPort())
......
......@@ -52,6 +52,13 @@ vtkImageReader2::vtkImageReader2()
this->DataSpacing[0] = this->DataSpacing[1] = this->DataSpacing[2] = 1.0;
this->DataDirection[0] =
this->DataDirection[4] =
this->DataDirection[8] = 1.0;
this->DataDirection[1] = this->DataDirection[2] =
this->DataDirection[3] = this->DataDirection[5] =
this->DataDirection[6] = this->DataDirection[7] = 0.0;
this->DataExtent[0] = this->DataExtent[2] = this->DataExtent[4] = 0;
this->DataExtent[1] = this->DataExtent[3] = this->DataExtent[5] = 0;
......@@ -441,6 +448,13 @@ void vtkImageReader2::PrintSelf(ostream& os, vtkIndent indent)
}
os << ")\n";
os << indent << "DataDirection: (" << this->DataDirection[0];
for (idx = 1; idx < 9; ++idx)
{
os << ", " << this->DataDirection[idx];
}
os << ")\n";
os << indent << "DataOrigin: (" << this->DataOrigin[0];
for (idx = 1; idx < 3; ++idx)
{
......@@ -499,6 +513,7 @@ int vtkImageReader2::RequestInformation (
this->DataExtent, 6);
outInfo->Set(vtkDataObject::SPACING(), this->DataSpacing, 3);
outInfo->Set(vtkDataObject::ORIGIN(), this->DataOrigin, 3);
outInfo->Set(vtkDataObject::DIRECTION(), this->DataDirection, 9);
vtkDataObject::SetPointDataActiveScalarInfo(outInfo, this->DataScalarType,
this->NumberOfScalarComponents);
......
......@@ -179,6 +179,14 @@ public:
vtkGetVector3Macro(DataOrigin,double);
//@}
//@{
/**
* Set/Get the direction of the data (9 elements: 3x3 matrix).
*/
vtkSetVectorMacro(DataDirection,double, 9);
vtkGetVectorMacro(DataDirection,double, 9);
//@}
//@{
/**
* Get the size of the header computed by this object.
......@@ -328,6 +336,7 @@ protected:
double DataSpacing[3];
double DataOrigin[3];
double DataDirection[9];
int FileNameSliceOffset;
int FileNameSliceSpacing;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment