Question

I am a beginner in VTK ITK, I am trying to read a DICOM series with ITK and display with VTK but I had pictures upside down, I tried to read a single image (JPG) with ITK and visualuser with VTK it is the same problem, so I had the idea of ​​treating the image on photoshop ie I applied to the original image rotation (vertical symmetry of the work area) and I did the reading with ITK and display with VTK, the image is displayed in the correct orientation, infact ITK keeps the orientation of the image, but the problem is at VTK, it is which displays the image upside down, I searched all over the internet I have not found a solution or a method or not even an idea, I encountered the same problem in many forums but there is no response, I count on your help, I can not apply any image processing to find a solution to this problem.

Please Help! thank you in advance

Was it helpful?

Solution

Ideally you should re-orient your camera in VTK so that it is suited for medical image visualization. (The default camera in VTK uses the computer graphics conventions).

If you want a quick hack, you can copy-paste the following code in ITK:

    FlipFilterType::Pointer flipperImage = FlipFilterType::New();
bool flipAxes[3] = { false, true, false };
flipperImage = FlipFilterType::New();
flipperImage->SetFlipAxes(flipAxes);
flipperImage->SetInput( image );
flipperImage->Update();

OTHER TIPS

I use a rapid way to set the orientation:

imageActor->SetOrientation(180,0,0);

No need to add filter.

Here's an example of how I would do it. I'm not sure what classes you are using, so I cannot be specific.

 vtkSmartPointer<vtkImageData> result = vtkSmartPointer<vtkIMageData>::New();
    result->DeepCopy(YourImage);  //DeepCopy your image to result
    rImage->Update();

    double val;
    int i = 0;

    for(vtkIdType f = result->GetNumberOfPoints()-1; f > -1; f--)
    {
      val = YourImage->GetPointData()->GetScalars()->GetTuple1(f);
      result->GetPointData()->GetScalars->SetTuple1(i,val);
      i++;
    }



result->Update();
//Now Visualize your image
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top