Page MenuHomePhabricator

mitk::CastToItkImage for 4D images
Closed, WontfixPublic

Description

It is not possible yet to convert 4D mitk images into 4D float ITK images.

Event Timeline

Wrote a change request in the MITK wiki page.

Please have a look at

Core/Code/Algorithms/mitkInstantiateAccessFunctions.h

We should also discuss the necessity of this for the support of group studies since it introduces a new concept for the 4th dimension which probably does not make sense for every filter.

I had a look at it. It is possible to convert 4D mitk images to itk images, apply itk filters on them and get back the result in a 4D mitk image. You have to use the correct macros. Do not use "AccessByItk" but "AccessFixedDimensioByItk" !!

Small example:

mitk::Image::Pointer imageSource;
mitk::Image::Pointer imageResult;
int param1 = 0;
int param2 = 120;

//fill imageSource with a 4D image from dataset
imageSource = dynamic_cast<mitk::Image*>(m_Controls->m_ImageSelector->GetSelectedNode()->GetData());

// init imageResult in the same dimensions as imageSource
imageResult->Initialize(imageSource);

// Call Macro
AccessFixedDimensionByItk_3(imageSource, ITKThresholdFilter, 4, imageResult, param1, param2);

// Templated ITK Filter Function
template < typename TPixel, unsigned int VImageDimension >
void ITKThresholdFilter( itk::Image<TPixel, VImageDimension>* inputImage, mitk::Image::Pointer& outputImage, int param1, int param2 )
{

typedef itk::Image<TPixel, VImageDimension>     ImageType;
typedef itk::BinaryThresholdImageFilter<ImageType,ImageType> ThresholdFilterType;

typename ThresholdFilterType::Pointer thFilter = ThresholdFilterType::New();
thFilter->SetLowerThreshold(param1 < param2 ? param1 : param2);
thFilter->SetUpperThreshold(param2 > param1 ? param2 : param1);
thFilter->SetInsideValue(1);
thFilter->SetOutsideValue(0);
thFilter->SetInput(inputImage);
thFilter->UpdateLargestPossibleRegion();
ImageType::Pointer itkImage = thFilter->GetOutput();
itkImage->Update();
mitk::CastToMitkImage(itkImage , outputImage );

}

If you want to see it in more detail, please have a look at the Bundle QmitkMitralValveSegmentation4DTee. I use it there.

The discription does not match what has been actually done.

wrong bug closed, demonstrating the folly of multitasking. will be reopened immediately.

need to discuss this when bastian is back in town

The AccessByItk macros have been generalized and this could be relevant for this bug. See T8492 and the updated documentation at http://docs.mitk.org/nightly-qt4/group__Adaptor.html .

Resetting all bugs without active assignee flag to "CONFIRMED". Change status to IN_PROGRESS if you are working on it.

kislinsk claimed this task.
kislinsk added a project: Auto-closed.
kislinsk added a subscriber: kislinsk.

Hi there! 🙂

This task was auto-closed according to our Task Lifecycle Management.
Please follow this link for more information and don't forget that you are encouraged to reasonable re-open tasks to revive them. 🚑

Best wishes,
The MITK devs

kislinsk removed kislinsk as the assignee of this task.May 26 2020, 12:05 PM
kislinsk removed a subscriber: kislinsk.