#include <itkTensorImageToDiffusionImageFilter.h>
Public Types | |
| typedef TInputScalarType | InputScalarType |
| typedef itk::DiffusionTensor3D < InputScalarType > | InputPixelType |
| typedef itk::Image < InputPixelType, 3 > | InputImageType |
| typedef InputImageType::RegionType | InputImageRegionType |
| typedef TOutputScalarType | OutputScalarType |
| typedef itk::VectorImage < OutputScalarType, 3 > | OutputImageType |
| typedef OutputImageType::PixelType | OutputPixelType |
| typedef OutputImageType::RegionType | OutputImageRegionType |
| typedef OutputScalarType | BaselineScalarType |
| typedef BaselineScalarType | BaselinePixelType |
| typedef itk::Image < BaselinePixelType, 3 > | BaselineImageType |
| typedef BaselineImageType::RegionType | BaselineImageRegionType |
| typedef TensorImageToDiffusionImageFilter | Self |
| typedef ImageToImageFilter < InputImageType, OutputImageType > | Superclass |
| typedef SmartPointer< Self > | Pointer |
| typedef SmartPointer< const Self > | ConstPointer |
| typedef Vector< double, 3 > | GradientType |
| typedef std::vector< GradientType > | GradientListType |
Public Member Functions | |
| virtual const char * | GetClassName () const |
| itkStaticConstMacro (ImageDimension, unsigned int, OutputImageType::ImageDimension) | |
| void | SetGradientList (const GradientListType list) |
| GradientListType | GetGradientList (void) const |
| void | SetBValue (const double &bval) |
Static Public Member Functions | |
| static Pointer | New () |
Protected Member Functions | |
| TensorImageToDiffusionImageFilter () | |
| ~TensorImageToDiffusionImageFilter () | |
| void | PrintSelf (std::ostream &os, Indent indent) const |
| void | BeforeThreadedGenerateData (void) |
| void | ThreadedGenerateData (const OutputImageRegionType &outputRegionForThread, int) |
Definition at line 27 of file itkTensorImageToDiffusionImageFilter.h.
| typedef BaselineImageType::RegionType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::BaselineImageRegionType |
Definition at line 46 of file itkTensorImageToDiffusionImageFilter.h.
| typedef itk::Image<BaselinePixelType,3> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::BaselineImageType |
Definition at line 45 of file itkTensorImageToDiffusionImageFilter.h.
| typedef BaselineScalarType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::BaselinePixelType |
Definition at line 44 of file itkTensorImageToDiffusionImageFilter.h.
| typedef OutputScalarType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::BaselineScalarType |
Definition at line 43 of file itkTensorImageToDiffusionImageFilter.h.
| typedef SmartPointer<const Self> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::ConstPointer |
Definition at line 52 of file itkTensorImageToDiffusionImageFilter.h.
| typedef std::vector<GradientType> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::GradientListType |
Definition at line 62 of file itkTensorImageToDiffusionImageFilter.h.
| typedef Vector<double,3> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::GradientType |
Definition at line 59 of file itkTensorImageToDiffusionImageFilter.h.
| typedef InputImageType::RegionType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::InputImageRegionType |
Definition at line 36 of file itkTensorImageToDiffusionImageFilter.h.
| typedef itk::Image<InputPixelType,3> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::InputImageType |
Definition at line 35 of file itkTensorImageToDiffusionImageFilter.h.
| typedef itk::DiffusionTensor3D<InputScalarType> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::InputPixelType |
Definition at line 34 of file itkTensorImageToDiffusionImageFilter.h.
| typedef TInputScalarType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::InputScalarType |
Definition at line 33 of file itkTensorImageToDiffusionImageFilter.h.
| typedef OutputImageType::RegionType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::OutputImageRegionType |
Definition at line 41 of file itkTensorImageToDiffusionImageFilter.h.
| typedef itk::VectorImage<OutputScalarType,3> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::OutputImageType |
Definition at line 39 of file itkTensorImageToDiffusionImageFilter.h.
| typedef OutputImageType::PixelType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::OutputPixelType |
Definition at line 40 of file itkTensorImageToDiffusionImageFilter.h.
| typedef TOutputScalarType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::OutputScalarType |
Definition at line 38 of file itkTensorImageToDiffusionImageFilter.h.
| typedef SmartPointer<Self> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::Pointer |
Definition at line 51 of file itkTensorImageToDiffusionImageFilter.h.
| typedef TensorImageToDiffusionImageFilter itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::Self |
Definition at line 48 of file itkTensorImageToDiffusionImageFilter.h.
| typedef ImageToImageFilter<InputImageType, OutputImageType> itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::Superclass |
Definition at line 49 of file itkTensorImageToDiffusionImageFilter.h.
| itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::TensorImageToDiffusionImageFilter | ( | ) | [inline, protected] |
Definition at line 78 of file itkTensorImageToDiffusionImageFilter.h.
{
m_BValue = 1.0;
m_BaselineImage = 0;
};
| itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::~TensorImageToDiffusionImageFilter | ( | ) | [inline, protected] |
Definition at line 83 of file itkTensorImageToDiffusionImageFilter.h.
{};
| void itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::BeforeThreadedGenerateData | ( | void | ) | [protected] |
Definition at line 63 of file itkTensorImageToDiffusionImageFilter.txx.
{
if( m_GradientList.size()==0 )
{
throw itk::ExceptionObject (__FILE__,__LINE__,"Error: gradient list is empty, cannot generate DWI.");
}
// create a B0 image by taking the norm of the tensor field * scale:
typedef itk::TensorToL2NormImageFilter<InputImageType, itk::Image<InputScalarType,3> >
TensorToL2NormFilterType;
typename TensorToL2NormFilterType::Pointer myFilter1 = TensorToL2NormFilterType::New();
myFilter1->SetInput (this->GetInput());
try
{
myFilter1->Update();
}
catch (itk::ExceptionObject &e)
{
std::cerr << e;
return;
}
typename itk::RescaleIntensityImageFilter< itk::Image<InputScalarType,3>, BaselineImageType>::Pointer rescaler=
itk::RescaleIntensityImageFilter<itk::Image<InputScalarType,3>, BaselineImageType>::New();
rescaler->SetOutputMinimum ( 0 );
rescaler->SetOutputMaximum ( 32767 );
rescaler->SetInput ( myFilter1->GetOutput() );
try
{
rescaler->Update();
}
catch (itk::ExceptionObject &e)
{
std::cerr << e;
return;
}
m_BaselineImage = rescaler->GetOutput();
typename OutputImageType::Pointer outImage = OutputImageType::New();
outImage->SetSpacing( this->GetInput()->GetSpacing() ); // Set the image spacing
outImage->SetOrigin( this->GetInput()->GetOrigin() ); // Set the image origin
outImage->SetDirection( this->GetInput()->GetDirection() ); // Set the image direction
outImage->SetLargestPossibleRegion( this->GetInput()->GetLargestPossibleRegion());
outImage->SetBufferedRegion( this->GetInput()->GetLargestPossibleRegion() );
outImage->SetRequestedRegion( this->GetInput()->GetLargestPossibleRegion() );
outImage->SetVectorLength(m_GradientList.size()+1);
outImage->Allocate();
this->SetNumberOfRequiredOutputs (1);
this->SetNthOutput (0, outImage);
}
| virtual const char* itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::GetClassName | ( | ) | const [virtual] |
| GradientListType itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::GetGradientList | ( | void | ) | const [inline] |
Definition at line 70 of file itkTensorImageToDiffusionImageFilter.h.
{return m_GradientList;}
| itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::itkStaticConstMacro | ( | ImageDimension | , |
| unsigned | int, | ||
| OutputImageType::ImageDimension | |||
| ) |
| static Pointer itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::New | ( | ) | [static] |
| void itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::PrintSelf | ( | std::ostream & | os, |
| Indent | indent | ||
| ) | const [inline, protected] |
Definition at line 85 of file itkTensorImageToDiffusionImageFilter.h.
{
Superclass::PrintSelf (os, indent);
}
| void itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::SetBValue | ( | const double & | bval ) | [inline] |
Definition at line 74 of file itkTensorImageToDiffusionImageFilter.h.
{ m_BValue = bval; }
| void itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::SetGradientList | ( | const GradientListType | list ) | [inline] |
Manually Set/Get a list of gradients
Definition at line 65 of file itkTensorImageToDiffusionImageFilter.h.
{
m_GradientList = list;
this->Modified();
}
| void itk::TensorImageToDiffusionImageFilter< TInputScalarType, TOutputScalarType >::ThreadedGenerateData | ( | const OutputImageRegionType & | outputRegionForThread, |
| int | threadId | ||
| ) | [protected] |
Definition at line 124 of file itkTensorImageToDiffusionImageFilter.txx.
References QuadProgPP::exp().
{
typedef ImageRegionIterator<OutputImageType> IteratorOutputType;
typedef ImageRegionConstIterator<InputImageType> IteratorInputType;
typedef ImageRegionConstIterator<BaselineImageType> IteratorBaselineType;
unsigned long numPixels = outputRegionForThread.GetNumberOfPixels();
unsigned long step = numPixels/100;
unsigned long progress = 0;
IteratorOutputType itOut (this->GetOutput(0), outputRegionForThread);
IteratorInputType itIn (this->GetInput(), outputRegionForThread);
IteratorBaselineType itB0 (m_BaselineImage, outputRegionForThread);
if( threadId==0 )
{
this->UpdateProgress (0.0);
}
while(!itIn.IsAtEnd())
{
if( this->GetAbortGenerateData() )
{
throw itk::ProcessAborted(__FILE__,__LINE__);
}
InputPixelType T = itIn.Get();
BaselinePixelType b0 = itB0.Get();
OutputPixelType out;
out.SetSize(m_GradientList.size()+1);
for( unsigned int i=0; i<m_GradientList.size(); i++)
{
if( b0 > 0)
{
GradientType g = m_GradientList[i];
InputPixelType S;
S[0] = g[0]*g[0];
S[1] = g[1]*g[0];
S[2] = g[2]*g[0];
S[3] = g[1]*g[1];
S[4] = g[2]*g[1];
S[5] = g[2]*g[2];
double res =
T[0]*S[0] + T[1]*S[1] + T[2]*S[2] +
T[1]*S[1] + T[3]*S[3] + T[4]*S[4] +
T[2]*S[2] + T[4]*S[4] + T[5]*S[5];
out[i] = static_cast<OutputScalarType>( 1.0*b0*exp ( -1.0 * m_BValue * res ) );
}
}
out[m_GradientList.size()] = b0;
itOut.Set(out);
if( threadId==0 && step>0)
{
if( (progress%step)==0 )
{
this->UpdateProgress ( double(progress)/double(numPixels) );
}
}
++progress;
++itB0;
++itIn;
++itOut;
}
if( threadId==0 )
{
this->UpdateProgress (1.0);
}
}
1.7.2