Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType > Class Template Reference

#include <mitkTeemDiffusionTensor3DReconstructionImageFilter.h>

Collaboration diagram for mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef TTensorPixelType TensorPixelType
typedef itk::Vector
< TensorPixelType, 7 > 
VectorType
typedef itk::Image< VectorType, 3 > VectorImageType
typedef itk::DiffusionTensor3D
< TensorPixelType
TensorType
typedef itk::Image< TensorType, 3 > ItkTensorImageType
typedef itk::Vector
< TensorPixelType, 6 > 
ItkTensorVectorType
typedef itk::Image
< ItkTensorVectorType, 3 > 
ItkTensorVectorImageType
typedef DiffusionImagePixelType DiffusionPixelType
typedef itk::VectorImage
< DiffusionPixelType, 3 > 
DiffusionImageType
typedef
TeemDiffusionTensor3DReconstructionImageFilter 
Self
typedef itk::Object Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual DiffusionImage
< DiffusionImagePixelType >
::Pointer 
GetInput ()
virtual void SetInput (typename DiffusionImage< DiffusionImagePixelType >::Pointer _arg)
virtual bool GetEstimateErrorImage ()
virtual void SetEstimateErrorImage (bool _arg)
virtual float GetSigma ()
virtual void SetSigma (float _arg)
virtual TeemTensorEstimationMethods GetEstimationMethod ()
virtual void SetEstimationMethod (TeemTensorEstimationMethods _arg)
virtual int GetNumIterations ()
virtual void SetNumIterations (int _arg)
virtual double GetConfidenceThreshold ()
virtual void SetConfidenceThreshold (double _arg)
virtual float GetConfidenceFuzzyness ()
virtual void SetConfidenceFuzzyness (float _arg)
virtual double GetMinPlausibleValue ()
virtual void SetMinPlausibleValue (double _arg)
virtual mitk::TensorImage::Pointer GetOutput ()
virtual mitk::TensorImage::Pointer GetOutputItk ()
virtual void Update ()

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 TeemDiffusionTensor3DReconstructionImageFilter ()
virtual ~TeemDiffusionTensor3DReconstructionImageFilter ()

Protected Attributes

DiffusionImage
< DiffusionImagePixelType >
::Pointer 
m_Input
bool m_EstimateErrorImage
float m_Sigma
TeemTensorEstimationMethods m_EstimationMethod
int m_NumIterations
double m_ConfidenceThreshold
float m_ConfidenceFuzzyness
double m_MinPlausibleValue
mitk::TensorImage::Pointer m_Output
mitk::TensorImage::Pointer m_OutputItk
mitk::Image::Pointer m_ErrorImage

Detailed Description

template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
class mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >

Definition at line 39 of file mitkTeemDiffusionTensor3DReconstructionImageFilter.h.


Member Typedef Documentation

template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::SmartPointer<const Self> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::ConstPointer
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::VectorImage< DiffusionPixelType, 3 > mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::DiffusionImageType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef DiffusionImagePixelType mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::DiffusionPixelType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::Image<TensorType,3 > mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::ItkTensorImageType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::Image<ItkTensorVectorType,3> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::ItkTensorVectorImageType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::Vector<TensorPixelType,6> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::ItkTensorVectorType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::SmartPointer<Self> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::Pointer
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef TeemDiffusionTensor3DReconstructionImageFilter mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::Self
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::Object mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::Superclass
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef TTensorPixelType mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::TensorPixelType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::DiffusionTensor3D<TensorPixelType> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::TensorType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::Image<VectorType,3> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::VectorImageType
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
typedef itk::Vector<TensorPixelType,7> mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::VectorType

Constructor & Destructor Documentation

template<class D , class T >
mitk::TeemDiffusionTensor3DReconstructionImageFilter< D, T >::~TeemDiffusionTensor3DReconstructionImageFilter (  ) [protected, virtual]

Member Function Documentation

template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual const char* mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetClassName (  ) const [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual float mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetConfidenceFuzzyness (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual double mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetConfidenceThreshold (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual bool mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetEstimateErrorImage (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual TeemTensorEstimationMethods mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetEstimationMethod (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual DiffusionImage<DiffusionImagePixelType>::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetInput (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual double mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetMinPlausibleValue (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual int mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetNumIterations (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual mitk::TensorImage::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetOutput (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual mitk::TensorImage::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetOutputItk (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual float mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::GetSigma (  ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
static Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::New (  ) [static]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetConfidenceFuzzyness ( float  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetConfidenceThreshold ( double  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetEstimateErrorImage ( bool  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetEstimationMethod ( TeemTensorEstimationMethods  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetInput ( typename DiffusionImage< DiffusionImagePixelType >::Pointer  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetMinPlausibleValue ( double  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetNumIterations ( int  _arg ) [virtual]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
virtual void mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::SetSigma ( float  _arg ) [virtual]
template<class D , class T >
void mitk::TeemDiffusionTensor3DReconstructionImageFilter< D, T >::Update (  ) [virtual]

Definition at line 76 of file mitkTeemDiffusionTensor3DReconstructionImageFilter.cpp.

References file_replace(), MITK_ERROR, mitk::TensorImage::New(), mitk::TeemTensorEstimationMethodsLLS, mitk::TeemTensorEstimationMethodsMLE, mitk::TeemTensorEstimationMethodsNLS, and mitk::TeemTensorEstimationMethodsWLS.

{

  // save input image to nrrd file in temp-folder
  char filename[512];
  srand((unsigned)time(0)); 
  int random_integer = rand();
  sprintf( filename, "dwi_%d.nhdr",random_integer);
  
  typedef mitk::NrrdDiffusionImageWriter<D> WriterType;
  typename WriterType::Pointer nrrdWriter = WriterType::New();
  nrrdWriter->SetInput( m_Input );
  //nrrdWriter->SetDirections(m_Input->GetDirections());
  //nrrdWriter->SetB_Value(m_Input->GetB_Value());
  nrrdWriter->SetFileName(filename);
  try
  {
    nrrdWriter->Update();
  }
  catch (itk::ExceptionObject e)
  {
    std::cout << e << std::endl;
  }

  file_replace(filename,"vector","list");

  // build up correct command from input params
  char command[4096];
  sprintf( command, "tend estim -i %s -B kvp -o tensors_%d.nhdr -knownB0 true",
    filename, random_integer);

  //m_DiffusionImages;
  if(m_EstimateErrorImage)
  {
    sprintf( command, "%s -ee error_image_%d.nhdr", command, random_integer);
  }

  if(m_Sigma != -19191919)
  {
    sprintf( command, "%s -sigma %f", command, m_Sigma);
  }

  switch(m_EstimationMethod)
  {
  case TeemTensorEstimationMethodsLLS:
    sprintf( command, "%s -est lls", command);
    break;
  case TeemTensorEstimationMethodsMLE:
    sprintf( command, "%s -est mle", command);
    break;
  case TeemTensorEstimationMethodsNLS:
    sprintf( command, "%s -est nls", command);
    break;
  case TeemTensorEstimationMethodsWLS:
    sprintf( command, "%s -est wls", command);
    break;
  }
  
  sprintf( command, "%s -wlsi %d", command, m_NumIterations);

  if(m_ConfidenceThreshold != -19191919.0)
  {
    sprintf( command, "%s -t %f", command, m_ConfidenceThreshold);
  }
  
  sprintf( command, "%s -soft %f", command, m_ConfidenceFuzzyness);
  sprintf( command, "%s -mv %f", command, m_MinPlausibleValue);
  
  // call tend estim command
  std::cout << "Calling <" << command << ">" << std::endl;
  int success = system(command);
  if(!success)
  {
    MITK_ERROR << "system command could not be called!";
  }

  remove(filename);
  sprintf( filename, "dwi_%d.raw", random_integer);
  remove(filename);

  // change kind from tensor to vector
  sprintf( filename, "tensors_%d.nhdr", random_integer);
  file_replace(filename,"3D-masked-symmetric-matrix","vector");

  //file_replace(filename,"3D-symmetric-matrix","vector");
  //itksys::SystemTools::ReplaceString(line,"3D-masked-symmetric-matrix","vector");
  //itksys::SystemTools::ReplaceString(line,"vector","domain");

  // read result as mitk::Image and provide it in m_Output
  typedef itk::ImageFileReader<VectorImageType> FileReaderType;
  typename FileReaderType::Pointer reader = FileReaderType::New();
  reader->SetFileName(filename);
  reader->Update();
  typename VectorImageType::Pointer vecImage = reader->GetOutput();
  
  remove(filename);
  sprintf( filename, "tensors_%d.raw", random_integer);
  remove(filename);

  typename ItkTensorImageType::Pointer itkTensorImage = ItkTensorImageType::New();
  itkTensorImage->SetSpacing( vecImage->GetSpacing() );   // Set the image spacing
  itkTensorImage->SetOrigin( vecImage->GetOrigin() );     // Set the image origin
  itkTensorImage->SetDirection( vecImage->GetDirection() );  // Set the image direction
  itkTensorImage->SetLargestPossibleRegion( vecImage->GetLargestPossibleRegion() );
  itkTensorImage->SetBufferedRegion( vecImage->GetLargestPossibleRegion() );
  itkTensorImage->SetRequestedRegion( vecImage->GetLargestPossibleRegion() );
  itkTensorImage->Allocate();
  
  itk::ImageRegionIterator<VectorImageType> it(vecImage,
    vecImage->GetLargestPossibleRegion());

  itk::ImageRegionIterator<ItkTensorImageType> it2(itkTensorImage,
    itkTensorImage->GetLargestPossibleRegion());
  it2 = it2.Begin();

  //#pragma omp parallel private (it)
  {
    for(it=it.Begin();!it.IsAtEnd(); ++it, ++it2)
    {
      //#pragma omp single nowait
      {
        VectorType vec = it.Get();
        TensorType tensor;
        for(int i=1;i<7;i++)
          tensor[i-1] = vec[i] * vec[0];
        it2.Set( tensor );
      }
    } // end for
  } // end ompparallel

  m_OutputItk = mitk::TensorImage::New();
  m_OutputItk->InitializeByItk(itkTensorImage.GetPointer());
  m_OutputItk->SetVolume( itkTensorImage->GetBufferPointer() );

  // in case: read resulting error-image and provide it in m_ErrorImage
  if(m_EstimateErrorImage)
  {
    // open error image here
  }

}

Member Data Documentation

template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
float mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_ConfidenceFuzzyness [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
double mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_ConfidenceThreshold [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
mitk::Image::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_ErrorImage [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
bool mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_EstimateErrorImage [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
TeemTensorEstimationMethods mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_EstimationMethod [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
DiffusionImage<DiffusionImagePixelType>::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_Input [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
double mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_MinPlausibleValue [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
int mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_NumIterations [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
mitk::TensorImage::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_Output [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
mitk::TensorImage::Pointer mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_OutputItk [protected]
template<class DiffusionImagePixelType = short, class TTensorPixelType = float>
float mitk::TeemDiffusionTensor3DReconstructionImageFilter< DiffusionImagePixelType, TTensorPixelType >::m_Sigma [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines