Difference between revisions of "MITK DiffusionImage Replacement Guide"
Jump to navigation
Jump to search
CasparGoch (talk | contribs) |
CasparGoch (talk | contribs) |
||
Line 10: | Line 10: | ||
=== Old code === | === Old code === | ||
− | <pre><nowiki> | + | <pre><nowiki>#!highlight c++ |
typedef mitk::DiffusionImage<DiffusionPixelType> DiffusionImageType; | typedef mitk::DiffusionImage<DiffusionPixelType> DiffusionImageType; | ||
typedef DiffusionImageType::GradientDirectionContainerType GradientDirectionContainerType; | typedef DiffusionImageType::GradientDirectionContainerType GradientDirectionContainerType; | ||
Line 31: | Line 31: | ||
− | <pre><nowiki> | + | <pre><nowiki>#!highlight c++ |
typedef itk::VectorImage<DiffusionPixelType, dimension> ITKDiffusionImageType; | typedef itk::VectorImage<DiffusionPixelType, dimension> ITKDiffusionImageType; | ||
typedef mitk::GradientDirectionsProperty::GradientDirectionsContainerType GradientDirectionContainerType; | typedef mitk::GradientDirectionsProperty::GradientDirectionsContainerType GradientDirectionContainerType; |
Revision as of 14:57, 7 August 2014
MITK Diffusion Image Replacement Guide
We have decided to remove the MITK::DiffusionImage and instead represent diffusion weighted images by mitk::Image pointing to an itk::VectorImage . This is mainly due to the fact, that there is no longer a reason to use separate classes and unifying the image reduces the maintenance cost.
What to replace
When adjusting your code to use the new data type you will have to replace the some calls, mitkDiffusionImagePointer is a MITK::DiffusionImage::Pointer, mitkImagePointer is the MITK::Image::Pointer containing the same data.
Old code
#!highlight c++ typedef mitk::DiffusionImage<DiffusionPixelType> DiffusionImageType; typedef DiffusionImageType::GradientDirectionContainerType GradientDirectionContainerType; // cast node DiffusionImageType* mitkDiffusionImagePointer= static_cast<DiffusionImageType*>(node->GetData()); // get gradient directions mitkDiffusionImagePointer->GetDirections(); // get reference b value mitkDiffusionImagePointer->GetReferenceBValue() // get the vector image data mitkDiffusionImagePointer->GetVectorImage()
New Code
#!highlight c++ typedef itk::VectorImage<DiffusionPixelType, dimension> ITKDiffusionImageType; typedef mitk::GradientDirectionsProperty::GradientDirectionsContainerType GradientDirectionContainerType; // cast node mitk::Image* mitkImagePointer = static_cast<mitk::Image*>(node->GetData()); // get gradient directions static_cast<mitk::GradientDirectionsProperty*>( mitkImagePointer->GetProperty("GradientDirections").GetPointer() )->GetGradientDirectionsContainer(); // get reference b value static_cast<mitk::FloatProperty*>(mitkImagePointer->GetProperty("ReferenceBValue").GetPointer() )->GetValue() // get the vector image data ITKDiffusionImageType::Pointer itkVectorImagePointer = ITKDiffusionImageType::New(); mitk::CastToItkVectorImage(mitkImagePointer, itkVectorImagePointer);