[vtkusers] Reslice+Users Transform

strioso tonti.simone at gmail.com
Thu Mar 27 11:08:38 EDT 2014


Hi guys,

I have some problems with vtkImageReslice. I have two volumes(MR and US) and
I want to realign these two volumes. To do this I use vtkImageReslice with
transform matrix calculated before like this:

    static double t[16] = {
        0.84537937, 0.51377839, -0.14616932, 64.103854,
        0.37424072, -0.76492788, -0.52424155, 23.099208,
        -0.38115298, 0.38848049, -0.83893107, -109.90416,
        0, 0, 0, 1 };
    vtkSmartPointer<vtkMatrix4x4> m = vtkSmartPointer<vtkMatrix4x4>::New();
    m->DeepCopy(t);
    vtkSmartPointer<vtkTransform> transform =
vtkSmartPointer<vtkTransform>::New();
    transform->SetMatrix(m);
    
    
    vtkImageData *input=0;
    //Lettura NIFTI
    vtkSmartPointer<vtkNIFTIImageReader>
readerMR=vtkSmartPointer<vtkNIFTIImageReader>::New();
    vtkSmartPointer<vtkNIFTIImageReader>
readerUS=vtkSmartPointer<vtkNIFTIImageReader>::New();
    readerMR->SetFileName(inputFilenameMR.c_str());
    readerUS->SetFileName(inputFilenameUS.c_str());
    readerMR->Update();
    readerUS->Update();
    input=readerUS->GetOutput();
    
    //Reslicing
    vtkSmartPointer<vtkImageReslice> reslice =
vtkSmartPointer<vtkImageReslice>::New();
    //MR image to be resliced
    reslice->SetInputConnection(readerMR->GetOutputPort());
    //transformation matrix
    reslice->SetResliceTransform(transform);
    // input US to provide dimension and spatial resolution
    reslice->SetInformationInput(input);
    // interpolation mode
    reslice->SetInterpolationModeToCubic();
    reslice->Update();

Make and build are made with no errors but the output reslice volume is
empty! Why?! Could someone help me? I try several solutions but all of these
gave the same problem. I think the problem is transformation matrix or
something connected because if I remove
"reslice->SetResliceTransform(transform);" the code works fine and the
output reslice volume isn't empty.
Thanks to all!

Simone



--
View this message in context: http://vtk.1045678.n5.nabble.com/Reslice-Users-Transform-tp5726554.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list