template<typename TReferenceImagePixelType, typename TGradientImagePixelType = TReferenceImagePixelType, typename TTensorPixelType = double, typename TMaskImageType = Image<unsigned char, 3>>
class itk::DiffusionTensor3DReconstructionImageFilter< TReferenceImagePixelType, TGradientImagePixelType, TTensorPixelType, TMaskImageType >
This class takes as input one or more reference image (acquired in the absence of diffusion sensitizing gradients) and 'n' diffusion weighted images and their gradient directions and computes an image of tensors. (with DiffusionTensor3D as the pixel type). Once that is done, you can apply filters on this tensor image to compute FA, ADC, RGB weighted maps etc.
- Inputs and Usage
- There are two ways to use this class. When you have one reference image and
n
gradient images, you would use the class as filter->SetReferenceImage( image0 );
filter->AddGradientImage( direction1, image1 );
filter->AddGradientImage( direction2, image2 );
...
- When you have the 'n' gradient and one or more reference images in a single multi-component image (VectorImage), you can specify the images simply as
filter->SetGradientImage( directionsContainer, vectorImage );
Note that this method is used to specify both the reference and gradient images. This is convenient when the DWI images are read in using the NRRD format. Like the Nrrd format, the reference images are those components of the vectorImage whose gradient direction is (0,0,0). If more than one reference image is present, they are averaged prior to applying the Stejskal-Tanner equations.
- Outputs
- The output image is an image of Tensors:
Image< DiffusionTensor3D< TTensorPixelType >, 3 >
- Parameters
- Threshold - Threshold on the reference image data. The output tensor will be a null tensor for pixels in the reference image that have a value less than this.
- BValue - See the documentation of SetBValue().
- At least 6 gradient images must be specified for the filter to be able to run.
- Template parameters
- The class is templated over the pixel type of the reference and gradient images (expected to be scalar data types) and the internal representation of the DiffusionTensor3D pixel (double, float etc).
- References:
- [1] C.F.Westin, S.E.Maier, H.Mamata, A.Nabavi, F.A.Jolesz, R.Kikinis, "Processing and visualization for Diffusion tensor MRI", Medical image Analysis, 2002, pp 93-108.
- [2] A Dual Tensor Basis Solution to the Stejskal-Tanner Equations for DT-MRI
- Warning
- Although this filter has been written to support multiple threads, please set the number of threads to 1.
filter->SetNumberOfWorkUnits(1);
This is due to buggy code in netlib/dsvdc, that is called by vnl_svd. (used to compute the pseudo-inverse to find the dual tensor basis).
- Author
- Xiaodong Tao, GE, for contributing parts of this class.
-
Casey Goodlet, UNC for patches to support multiple baseline images and other improvements.
- Note
- This work is part of the National Alliance for Medical image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
- Examples and Datasets
- Sample DTI datasets may be obtained from
* \li ftp://public.kitware.com/pub/namic/DTI/Data/dwi.nhdr
* \li ftp://public.kitware.com/pub/namic/DTI/Data/dwi.img.gz ( gunzip this )
*
- See also
- DiffusionTensor3D SymmetricSecondRankTensor
Definition at line 149 of file itkDiffusionTensor3DReconstructionImageFilter.h.
|
using | CoefficientMatrixType = vnl_matrix< double > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | GradientDirectionContainerType = VectorContainer< unsigned int, GradientDirectionType > |
|
using | GradientDirectionType = vnl_vector_fixed< double, 3 > |
|
using | GradientImagesType = VectorImage< GradientPixelType, 3 > |
|
using | GradientImageType = Image< GradientPixelType, 3 > |
|
using | GradientPixelType = TGradientImagePixelType |
|
using | MaskImageType = TMaskImageType |
|
using | MaskSpatialObjectType = SpatialObject< 3 > |
|
using | OutputImageType = TensorImageType |
|
using | Pointer = SmartPointer< Self > |
|
using | ReferenceImageType = typename Superclass::InputImageType |
|
using | ReferencePixelType = TReferenceImagePixelType |
|
using | Self = DiffusionTensor3DReconstructionImageFilter |
|
using | Superclass = ImageToImageFilter< Image< TReferenceImagePixelType, 3 >, Image< DiffusionTensor3D< TTensorPixelType >, 3 > > |
|
using | TensorBasisMatrixType = vnl_matrix_fixed< double, 6, 6 > |
|
using | TensorImageType = Image< TensorPixelType, 3 > |
|
using | TensorPixelType = DiffusionTensor3D< TTensorPixelType > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | InputImageConstPointer = typename InputImageType::ConstPointer |
|
using | InputImagePixelType = typename InputImageType::PixelType |
|
using | InputImagePointer = typename InputImageType::Pointer |
|
using | InputImageRegionType = typename InputImageType::RegionType |
|
using | InputImageType = Image< TReferenceImagePixelType, 3 > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = ImageToImageFilter |
|
using | Superclass = ImageSource< Image< DiffusionTensor3D< double >, 3 > > |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | DataObjectIdentifierType = Superclass::DataObjectIdentifierType |
|
using | DataObjectPointer = DataObject::Pointer |
|
using | DataObjectPointerArraySizeType = Superclass::DataObjectPointerArraySizeType |
|
using | OutputImagePixelType = typename OutputImageType::PixelType |
|
using | OutputImagePointer = typename OutputImageType::Pointer |
|
using | OutputImageRegionType = typename OutputImageType::RegionType |
|
using | OutputImageType = Image< DiffusionTensor3D< double >, 3 > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = ImageSource |
|
using | Superclass = ProcessObject |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | DataObjectIdentifierType = DataObject::DataObjectIdentifierType |
|
using | DataObjectPointer = DataObject::Pointer |
|
using | DataObjectPointerArray = std::vector< DataObjectPointer > |
|
using | DataObjectPointerArraySizeType = DataObjectPointerArray::size_type |
|
using | MultiThreaderType = MultiThreaderBase |
|
using | NameArray = std::vector< DataObjectIdentifierType > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = ProcessObject |
|
using | Superclass = Object |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = Object |
|
using | Superclass = LightObject |
|
using | ConstPointer = SmartPointer< const Self > |
|
using | Pointer = SmartPointer< Self > |
|
using | Self = LightObject |
|
|
const char * | GetNameOfClass () const override |
|
virtual ReferenceImageType * | GetReferenceImage () |
|
void | SetGradientImage (GradientDirectionContainerType *, const GradientImagesType *gradientImage) |
|
void | SetMaskImage (MaskImageType *maskImage) |
|
void | SetMaskSpatialObject (MaskSpatialObjectType *maskSpatialObject) |
|
void | SetReferenceImage (ReferenceImageType *referenceImage) |
|
|
void | AddGradientImage (const GradientDirectionType &, const GradientImageType *gradientImage) |
|
const GradientImageType * | GetGradientImage (unsigned int index) const |
|
|
virtual GradientDirectionType | GetGradientDirection (unsigned int idx) const |
|
|
virtual void | SetThreshold (ReferencePixelType _arg) |
|
virtual ReferencePixelType | GetThreshold () const |
|
|
virtual void | SetBValue (TTensorPixelType _arg) |
|
virtual const TTensorPixelType & | GetBValue () const |
|
const InputImageType * | GetInput () const |
|
const InputImageType * | GetInput (unsigned int idx) const |
|
const char * | GetNameOfClass () const override |
|
void | PopBackInput () override |
|
void | PopFrontInput () override |
|
virtual void | PushBackInput (const InputImageType *input) |
|
virtual void | PushFrontInput (const InputImageType *input) |
|
virtual void | SetInput (const DataObjectIdentifierType &key, DataObject *input) |
|
virtual void | SetInput (const InputImageType *input) |
|
virtual void | SetInput (unsigned int, const Image< TReferenceImagePixelType, 3 > *image) |
|
virtual void | SetCoordinateTolerance (double _arg) |
|
virtual double | GetCoordinateTolerance () const |
|
virtual void | SetDirectionTolerance (double _arg) |
|
virtual double | GetDirectionTolerance () const |
|
const char * | GetNameOfClass () const override |
|
OutputImageType * | GetOutput (unsigned int idx) |
|
OutputImageType * | GetOutput () |
|
const OutputImageType * | GetOutput () const |
|
virtual void | GraftOutput (DataObject *graft) |
|
virtual void | GraftOutput (const DataObjectIdentifierType &key, DataObject *graft) |
|
virtual void | GraftNthOutput (unsigned int idx, DataObject *graft) |
|
ProcessObject::DataObjectPointer | MakeOutput (ProcessObject::DataObjectPointerArraySizeType idx) override |
|
ProcessObject::DataObjectPointer | MakeOutput (const ProcessObject::DataObjectIdentifierType &) override |
|
virtual void | AbortGenerateDataOn () |
|
virtual void | EnlargeOutputRequestedRegion (DataObject *) |
|
virtual const bool & | GetAbortGenerateData () const |
|
DataObjectPointerArray | GetIndexedInputs () |
|
DataObjectPointerArray | GetIndexedOutputs () |
|
NameArray | GetInputNames () const |
|
DataObjectPointerArray | GetInputs () |
|
MultiThreaderType * | GetMultiThreader () const |
|
const char * | GetNameOfClass () const override |
|
DataObjectPointerArraySizeType | GetNumberOfIndexedInputs () const |
|
DataObjectPointerArraySizeType | GetNumberOfIndexedOutputs () const |
|
DataObjectPointerArraySizeType | GetNumberOfInputs () const |
|
DataObjectPointerArraySizeType | GetNumberOfOutputs () const |
|
virtual DataObjectPointerArraySizeType | GetNumberOfValidRequiredInputs () const |
|
NameArray | GetOutputNames () const |
|
DataObjectPointerArray | GetOutputs () |
|
virtual float | GetProgress () const |
|
NameArray | GetRequiredInputNames () const |
|
bool | HasInput (const DataObjectIdentifierType &key) const |
|
bool | HasOutput (const DataObjectIdentifierType &key) const |
|
void | IncrementProgress (float increment) |
|
virtual DataObjectPointer | MakeOutput (const DataObjectIdentifierType &) |
|
virtual DataObjectPointer | MakeOutput (DataObjectPointerArraySizeType idx) |
|
virtual void | PrepareOutputs () |
|
virtual void | PropagateRequestedRegion (DataObject *output) |
|
virtual void | ResetPipeline () |
|
virtual void | SetAbortGenerateData (bool _arg) |
|
void | SetMultiThreader (MultiThreaderType *threader) |
|
virtual void | Update () |
|
virtual void | UpdateLargestPossibleRegion () |
|
virtual void | UpdateOutputData (DataObject *output) |
|
virtual void | UpdateOutputInformation () |
|
void | UpdateProgress (float progress) |
|
virtual void | SetReleaseDataFlag (bool val) |
|
virtual bool | GetReleaseDataFlag () const |
|
void | ReleaseDataFlagOn () |
|
void | ReleaseDataFlagOff () |
|
virtual void | SetReleaseDataBeforeUpdateFlag (bool _arg) |
|
virtual const bool & | GetReleaseDataBeforeUpdateFlag () const |
|
virtual void | ReleaseDataBeforeUpdateFlagOn () |
|
virtual void | SetNumberOfWorkUnits (ThreadIdType _arg) |
|
virtual const ThreadIdType & | GetNumberOfWorkUnits () const |
|
unsigned long | AddObserver (const EventObject &event, Command *cmd) const |
|
unsigned long | AddObserver (const EventObject &event, std::function< void(const EventObject &)> function) const |
|
LightObject::Pointer | CreateAnother () const override |
|
virtual void | DebugOff () const |
|
virtual void | DebugOn () const |
|
Command * | GetCommand (unsigned long tag) |
|
bool | GetDebug () const |
|
MetaDataDictionary & | GetMetaDataDictionary () |
|
const MetaDataDictionary & | GetMetaDataDictionary () const |
|
virtual ModifiedTimeType | GetMTime () const |
|
const char * | GetNameOfClass () const override |
|
virtual const TimeStamp & | GetTimeStamp () const |
|
bool | HasObserver (const EventObject &event) const |
|
void | InvokeEvent (const EventObject &) |
|
void | InvokeEvent (const EventObject &) const |
|
virtual void | Modified () const |
|
void | Register () const override |
|
void | RemoveAllObservers () |
|
void | RemoveObserver (unsigned long tag) const |
|
void | SetDebug (bool debugFlag) const |
|
void | SetReferenceCount (int) override |
|
void | UnRegister () const noexcept override |
|
void | SetMetaDataDictionary (const MetaDataDictionary &rhs) |
|
void | SetMetaDataDictionary (MetaDataDictionary &&rrhs) |
|
virtual void | SetObjectName (std::string _arg) |
|
virtual const std::string & | GetObjectName () const |
|
Pointer | Clone () const |
|
virtual Pointer | CreateAnother () const |
|
virtual void | Delete () |
|
virtual const char * | GetNameOfClass () const |
|
virtual int | GetReferenceCount () const |
|
void | Print (std::ostream &os, Indent indent=0) const |
|
virtual void | Register () const |
|
virtual void | SetReferenceCount (int) |
|
virtual void | UnRegister () const noexcept |
|
|
void | BeforeThreadedGenerateData () override |
|
void | ComputeTensorBasis () |
|
| DiffusionTensor3DReconstructionImageFilter () |
|
void | DynamicThreadedGenerateData (const OutputImageRegionType &outputRegionForThread) override |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
void | VerifyPreconditions () const override |
|
| ~DiffusionTensor3DReconstructionImageFilter () override=default |
|
virtual void | CallCopyInputRegionToOutputRegion (OutputImageRegionType &destRegion, const InputImageRegionType &srcRegion) |
|
virtual void | CallCopyOutputRegionToInputRegion (InputImageRegionType &destRegion, const OutputImageRegionType &srcRegion) |
|
void | GenerateInputRequestedRegion () override |
|
| ImageToImageFilter () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
void | VerifyInputInformation () const override |
|
| ~ImageToImageFilter () override=default |
|
virtual void | PushBackInput (const DataObject *input) |
|
virtual void | PushFrontInput (const DataObject *input) |
|
virtual void | AfterThreadedGenerateData () |
|
virtual void | AllocateOutputs () |
|
virtual void | BeforeThreadedGenerateData () |
|
void | ClassicMultiThread (ThreadFunctionType callbackFunction) |
|
void | GenerateData () override |
|
virtual const ImageRegionSplitterBase * | GetImageRegionSplitter () const |
|
| ImageSource () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
virtual unsigned int | SplitRequestedRegion (unsigned int i, unsigned int pieces, OutputImageRegionType &splitRegion) |
|
| ~ImageSource () override=default |
|
virtual void | ThreadedGenerateData (const OutputImageRegionType ®ion, ThreadIdType threadId) |
|
virtual bool | GetDynamicMultiThreading () const |
|
virtual void | SetDynamicMultiThreading (bool _arg) |
|
virtual void | DynamicMultiThreadingOn () |
|
virtual void | AddInput (DataObject *input) |
|
void | AddOptionalInputName (const DataObjectIdentifierType &) |
|
void | AddOptionalInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
virtual void | AddOutput (DataObject *output) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &) |
|
bool | AddRequiredInputName (const DataObjectIdentifierType &, DataObjectPointerArraySizeType idx) |
|
virtual void | CacheInputReleaseDataFlags () |
|
virtual void | GenerateData () |
|
virtual void | GenerateInputRequestedRegion () |
|
virtual void | GenerateOutputInformation () |
|
virtual void | GenerateOutputRequestedRegion (DataObject *output) |
|
DataObject * | GetInput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetInput (const DataObjectIdentifierType &key) const |
|
virtual const DataObjectPointerArraySizeType & | GetNumberOfRequiredInputs () const |
|
virtual const DataObjectPointerArraySizeType & | GetNumberOfRequiredOutputs () const |
|
bool | IsIndexedInputName (const DataObjectIdentifierType &) const |
|
bool | IsIndexedOutputName (const DataObjectIdentifierType &) const |
|
bool | IsRequiredInputName (const DataObjectIdentifierType &) const |
|
DataObjectPointerArraySizeType | MakeIndexFromInputName (const DataObjectIdentifierType &name) const |
|
DataObjectPointerArraySizeType | MakeIndexFromOutputName (const DataObjectIdentifierType &name) const |
|
DataObjectIdentifierType | MakeNameFromInputIndex (DataObjectPointerArraySizeType idx) const |
|
DataObjectIdentifierType | MakeNameFromOutputIndex (DataObjectPointerArraySizeType idx) const |
|
virtual void | PopBackInput () |
|
virtual void | PopFrontInput () |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
| ProcessObject () |
|
virtual void | PropagateResetPipeline () |
|
virtual void | PushBackInput (const DataObject *input) |
|
virtual void | PushFrontInput (const DataObject *input) |
|
virtual void | ReleaseInputs () |
|
virtual void | RemoveInput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveInput (DataObjectPointerArraySizeType) |
|
virtual void | RemoveOutput (const DataObjectIdentifierType &key) |
|
virtual void | RemoveOutput (DataObjectPointerArraySizeType idx) |
|
bool | RemoveRequiredInputName (const DataObjectIdentifierType &) |
|
virtual void | RestoreInputReleaseDataFlags () |
|
virtual void | SetInput (const DataObjectIdentifierType &key, DataObject *input) |
|
virtual void | SetNthInput (DataObjectPointerArraySizeType idx, DataObject *input) |
|
virtual void | SetNthOutput (DataObjectPointerArraySizeType idx, DataObject *output) |
|
void | SetNumberOfIndexedInputs (DataObjectPointerArraySizeType num) |
|
void | SetNumberOfIndexedOutputs (DataObjectPointerArraySizeType num) |
|
virtual void | SetNumberOfRequiredInputs (DataObjectPointerArraySizeType) |
|
virtual void | SetNumberOfRequiredOutputs (DataObjectPointerArraySizeType _arg) |
|
virtual void | SetOutput (const DataObjectIdentifierType &name, DataObject *output) |
|
virtual void | SetPrimaryInput (DataObject *object) |
|
virtual void | SetPrimaryOutput (DataObject *object) |
|
void | SetRequiredInputNames (const NameArray &) |
|
virtual void | VerifyInputInformation () const |
|
virtual void | VerifyPreconditions () const |
|
| ~ProcessObject () override |
|
DataObject * | GetInput (DataObjectPointerArraySizeType idx) |
|
const DataObject * | GetInput (DataObjectPointerArraySizeType idx) const |
|
DataObject * | GetPrimaryInput () |
|
const DataObject * | GetPrimaryInput () const |
|
virtual void | SetPrimaryInputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryInputName () const |
|
DataObject * | GetOutput (const DataObjectIdentifierType &key) |
|
const DataObject * | GetOutput (const DataObjectIdentifierType &key) const |
|
virtual void | SetPrimaryOutputName (const DataObjectIdentifierType &key) |
|
virtual const char * | GetPrimaryOutputName () const |
|
DataObject * | GetOutput (DataObjectPointerArraySizeType i) |
|
const DataObject * | GetOutput (DataObjectPointerArraySizeType i) const |
|
DataObject * | GetPrimaryOutput () |
|
const DataObject * | GetPrimaryOutput () const |
|
virtual bool | GetThreaderUpdateProgress () const |
|
virtual void | ThreaderUpdateProgressOn () |
|
virtual void | SetThreaderUpdateProgress (bool arg) |
|
| Object () |
|
bool | PrintObservers (std::ostream &os, Indent indent) const |
|
void | PrintSelf (std::ostream &os, Indent indent) const override |
|
virtual void | SetTimeStamp (const TimeStamp &timeStamp) |
|
| ~Object () override |
|
virtual LightObject::Pointer | InternalClone () const |
|
| LightObject () |
|
virtual void | PrintHeader (std::ostream &os, Indent indent) const |
|
virtual void | PrintSelf (std::ostream &os, Indent indent) const |
|
virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
|
virtual | ~LightObject () |
|
template<typename TReferenceImagePixelType , typename TGradientImagePixelType = TReferenceImagePixelType, typename TTensorPixelType = double, typename TMaskImageType = Image<unsigned char, 3>>
If an imaging filter can be implemented as a multithreaded algorithm, the filter will provide an implementation of ThreadedGenerateData() or DynamicThreadedGenerateData(). This superclass will automatically split the output image into a number of pieces, spawn multiple threads, and call (Dynamic)ThreadedGenerateData() in each thread. Prior to spawning threads, the BeforeThreadedGenerateData() method is called. After all the threads have completed, the AfterThreadedGenerateData() method is called. If an image processing filter cannot support threading, that filter should provide an implementation of the GenerateData() method instead of providing an implementation of (Dynamic)ThreadedGenerateData(). If a filter provides a GenerateData() method as its implementation, then the filter is responsible for allocating the output data. If a filter provides a (Dynamic)ThreadedGenerateData() method as its implementation, then the output memory will allocated automatically by this superclass. The (Dynamic)ThreadedGenerateData() method should only produce the output specified by "outputThreadRegion" parameter. (Dynamic)ThreadedGenerateData() cannot write to any other portion of the output image (as this is responsibility of a different thread).
DynamicThreadedGenerateData() is the newer variant without threadId, and is the preferred signature, which is called by default. This variant can split the requested region into different number of pieces depending on current multi-processing load, which allows better load balancing. The non-dynamic (also known as classic) ThreadedGenerateData() signature has threadId, and number of pieces to be split into is known in advance. It is activated by calling this->DynamicMultiThreadingOff(); in derived class constructor. It should be used when the multi-threaded algorithm needs to pre-allocate some data structure with size dependent on the number of pieces (also known as chunks, work units, and sometimes also incorrectly as threads). Only PlatformMultiThreader guarantees that each piece will be processed in its own specific thread. Pool and TBB multi-threaders maintain a pool of threads (normally equal to number of processing cores) which they use to process the pieces. This normally results in a single thread being reused to process multiple work units.
- See also
- GenerateData(), SplitRequestedRegion()
Reimplemented from itk::ImageSource< Image< DiffusionTensor3D< double >, 3 > >.
template<typename TReferenceImagePixelType , typename TGradientImagePixelType = TReferenceImagePixelType, typename TTensorPixelType = double, typename TMaskImageType = Image<unsigned char, 3>>
Verifies that the process object has been configured correctly, that all required inputs are set, and needed parameters are set appropriately. If not valid an exceptions will be thrown.
This method is called before UpdateOutputInformation() is propagated to the inputs.
The ProcessObject's implementation verifies that the m_NumberOfRequiredInputs are set and not null.
Reimplemented from itk::ProcessObject.