Flip image data

Hi,

I is it possible to flip vtkImageData and wrap the result in vtkMRMLScalarVolumeNode?

For example I can see that VTK has vtkImageFlip but for me it doesnt work:

  vtkNew<vtkImageData> imageData;
  imageData->SetDimensions(samples.size(), uXL.size(), uIL.size());
  imageData->AllocateScalars(VTK_FLOAT, 1);
  imageData->GetPointData()->SetScalars(TRACE);

  vtkNew<vtkImageFlip> imageFlip;
  imageFlip->SetInputData(imageData);
  imageFlip->SetFilteredAxis(1);
  imageFlip->Update();

  vtkNew<vtkMRMLScalarVolumeNode> volumeNode;
  volumeNode->SetName(nodeName.c_str());
  volumeNode->SetAndObserveImageData(imageData);

I think I do something wrong…

By the way simple rotation transform doesn’t solve my issue

I’m sorry
I just found a solution on internet.
I should have been using:

...
volumeNode->SetAndObserveImageData(imageFlip->GetOutput()); // `imageFlip->GetOutput()` returns `vtkImageData`
1 Like