[vtkusers] vtkResliceImage and appending slices
David Gobbi
david.gobbi at gmail.com
Wed Sep 3 09:53:48 EDT 2014
Hi Zarko,
Thanks for the info. If each slice has a different normal,
then it is necessary to extract each slice separately (like
you are doing), and then you can use vtkImageAppend
to create a volume from all of the slices.
However, when you use vtkImageReslice to do oblique
slices, I recommend that you always set the OutputExtent,
OutputSpacing, and OutputOrigin for vtkImageReslice.
The code that vtkImageReslice uses to "guess" these
values is really only useful for orthogonal reslicing.
- David
On Wed, Sep 3, 2014 at 7:38 AM, zarko.milosevic <zarko at kg.ac.rs> wrote:
> Hi David,
>
> Some basic intro:
>
> I first create one 3D vtkParametricSpline that goes through volume (DICOM
> image stack). You can consider that spline as central line of some blood
> vessel.
> In one loop I got through all points and create Directional vectors by
> subtracting (i+1)th point from ith point ofthe spline.
> Next I create 4x4 matrix (re-slice axes) based on that directional vector
> and two vectors perpendicular to directional one. Actually I create
> coordinate frame based on that three vectors.
> Every iteration of the loop ends with new re-slice axes and new oblique
> slice.
>
> What I want is to merge those slices in one new 3D image which a will on the
> end slice it with vtkImageReslice.
>
> Here is some code:
> {
> // vtkResliceImage initialization
> _imageReslice = vtkSmartPointer<vtkImageReslice>::New();
> _imageReslice->SetInputConnection(reader->GetOutputPort());
> _imageReslice->SetResliceAxes(this->GetViewAxes());
> _imageReslice->SetOutputDimensionality(2);
>
> vtkSmartPointer<vtkLookupTable> lut =
> vtkSmartPointer<vtkLookupTable>::New();
> lut->SetRange(0, 255);
> lut->SetValueRange(0.0, 1.0);
> lut->SetSaturationRange(0.0, 0.0);
> lut->SetRampToLinear();
> lut->Build();
>
> vtkSmartPointer<vtkImageMapToColors> colorMapper =
> vtkSmartPointer<vtkImageMapToColors>::New();
>
> colorMapper->SetLookupTable(lut);
> colorMapper->SetInputConnection(_imageReslice->GetOutputPort());
>
> _actorImage = vtkSmartPointer<vtkImageActor>::New();
> _actorImage->SetInput(colorMapper->GetOutput());
> _renderer = vtkSmartPointer<vtkRenderer>::New();
> .
> .
> .
> }
>
> {
> // Iteration through spline - this is part of from some other method
> vtkSmartPointer<vtkMatrix4x4> axes = null;
> axes = GetViewAxes();
> while(axes)
> {
> _imageReslice->SetResliceAxes();
> _imageReslice->Update();
> axes = GetViewAxes(); // in this method I calculate re-slice axes
> }
> .
> .
> .
>
> // Here after every iteration I get new oblique slice. What I want is to
> join all slices together in
> // one new 3d image which will be input for new vtkImageReslice object.
> }
More information about the vtkusers
mailing list