diff --git a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.h b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.h index d7079e4889..5f3820f3c5 100644 --- a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.h +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.h @@ -1,90 +1,90 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ Version: $Revision: 18127 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #ifndef __itkB0ImageExtractionImageFilter_h_ #define __itkB0ImageExtractionImageFilter_h_ #include "itkImageToImageFilter.h" namespace itk{ /** \class B0ImageExtractionImageFilter * \brief This class takes as input a T2-weighted image and computes a brainmask. * */ template< class TInputImagePixelType, class TOutputImagePixelType > class B0ImageExtractionImageFilter : public ImageToImageFilter< VectorImage, Image< TOutputImagePixelType, 3 > > { public: typedef B0ImageExtractionImageFilter Self; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; typedef ImageToImageFilter< VectorImage< TInputImagePixelType, 3 >, Image< TOutputImagePixelType, 3 > > Superclass; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Runtime information support. */ itkTypeMacro(B0ImageExtractionImageFilter, ImageToImageFilter); typedef TInputImagePixelType InputPixelType; typedef TOutputImagePixelType OutputPixelType; typedef typename Superclass::InputImageType InputImageType; typedef typename Superclass::OutputImageType OutputImageType; typedef typename Superclass::OutputImageRegionType OutputImageRegionType; typedef vnl_vector_fixed< double, 3 > GradientDirectionType; typedef itk::VectorContainer< unsigned int, GradientDirectionType > GradientDirectionContainerType; GradientDirectionContainerType::Pointer GetDirections() { return m_Directions; } void SetDirections( GradientDirectionContainerType::Pointer directions ) { this->m_Directions = directions; } protected: B0ImageExtractionImageFilter(); - ~B0ImageExtractionImageFilter() {}; + virtual ~B0ImageExtractionImageFilter() {}; void GenerateData(); GradientDirectionContainerType::Pointer m_Directions; }; } #ifndef ITK_MANUAL_INSTANTIATION #include "itkB0ImageExtractionImageFilter.txx" #endif #endif //__itkB0ImageExtractionImageFilter_h_ diff --git a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h new file mode 100644 index 0000000000..35991104a2 --- /dev/null +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h @@ -0,0 +1,65 @@ +/*========================================================================= + +Program: Medical Imaging & Interaction Toolkit +Language: C++ +Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ +Version: $Revision: 18127 $ + +Copyright (c) German Cancer Research Center, Division of Medical and +Biological Informatics. All rights reserved. +See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. + +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ + +#ifndef ITKB0IMAGEEXTRACTIONTOSEPARATEIMAGEFILTER_H +#define ITKB0IMAGEEXTRACTIONTOSEPARATEIMAGEFILTER_H + +#include "itkB0ImageExtractionImageFilter.h" + +namespace itk +{ + /** \class B0ImageExtractionToSeparateImageFilter + \brief This class extends the B0ImageExtractionImageFilter, it returns a time-sliced image containing + all available b0 images for given DWI Image + */ + +template< class TInputImagePixelType, +class TOutputImagePixelType > +class B0ImageExtractionToSeparateImageFilter : + public B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType > +{ +public: + + /** basic typedefs */ + typedef B0ImageExtractionImageFilter< + TInputImagePixelType, TOutputImagePixelType > Superclass; + typedef B0ImageExtractionToSeparateImageFilter Self; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(B0ImageExtractionToSeparateImageFilter, + B0ImageExtractionImageFilter); + +protected: + + B0ImageExtractionToSeparateImageFilter(); + virtual ~B0ImageExtractionToSeparateImageFilter(){}; + + void GenerateData(); +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkB0ImageExtractionToSeparateImageFilter.txx" +#endif + +#endif // ITKB0IMAGEEXTRACTIONTOSEPARATEIMAGEFILTER_H diff --git a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx new file mode 100644 index 0000000000..0196078323 --- /dev/null +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx @@ -0,0 +1,39 @@ +/*========================================================================= + +Program: Medical Imaging & Interaction Toolkit +Language: C++ +Date: $Date: 2009-07-14 19:11:20 +0200 (Tue, 14 Jul 2009) $ +Version: $Revision: 18127 $ + +Copyright (c) German Cancer Research Center, Division of Medical and +Biological Informatics. All rights reserved. +See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. + +This software is distributed WITHOUT ANY WARRANTY; without even +the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef __itkB0ImageExtractionToSeparateImageFilter_txx +#define __itkB0ImageExtractionToSeparateImageFilter_txx + +#include "itkB0ImageExtractionToSeparateImageFilter.h" + +template< class TInputImagePixelType, + class TOutputImagePixelType> + itk::B0ImageExtractionToSeparateImageFilter< TInputImagePixelType, TOutputImagePixelType > + ::B0ImageExtractionToSeparateImageFilter() + : B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType >() + { + + } + +template< class TInputImagePixelType, + class TOutputImagePixelType> + void itk::B0ImageExtractionToSeparateImageFilter< + TInputImagePixelType, TOutputImagePixelType >::GenerateData() + { + + } + +#endif // ifndef __itkB0ImageExtractionToSeparateImageFilter_txx diff --git a/Modules/DiffusionImaging/files.cmake b/Modules/DiffusionImaging/files.cmake index d3a7484ab7..47f40221f0 100644 --- a/Modules/DiffusionImaging/files.cmake +++ b/Modules/DiffusionImaging/files.cmake @@ -1,165 +1,166 @@ set(CPP_FILES # DicomImport DicomImport/mitkDicomDiffusionImageReader.cpp DicomImport/mitkGroupDiffusionHeadersFilter.cpp DicomImport/mitkDicomDiffusionImageHeaderReader.cpp DicomImport/mitkGEDicomDiffusionImageHeaderReader.cpp DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.cpp DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.cpp DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.cpp # DataStructures IODataStructures/mitkDiffusionImagingObjectFactory.cpp # DataStructures -> DWI IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.cpp IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSource.cpp IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageReader.cpp IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.cpp IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageIOFactory.cpp IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriterFactory.cpp IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp # DataStructures -> QBall IODataStructures/QBallImages/mitkQBallImageSource.cpp IODataStructures/QBallImages/mitkNrrdQBallImageReader.cpp IODataStructures/QBallImages/mitkNrrdQBallImageWriter.cpp IODataStructures/QBallImages/mitkNrrdQBallImageIOFactory.cpp IODataStructures/QBallImages/mitkNrrdQBallImageWriterFactory.cpp IODataStructures/QBallImages/mitkQBallImage.cpp IODataStructures/QBallImages/mitkQBallImageSerializer.cpp # DataStructures -> Tensor IODataStructures/TensorImages/mitkTensorImageSource.cpp IODataStructures/TensorImages/mitkNrrdTensorImageReader.cpp IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp IODataStructures/TensorImages/mitkNrrdTensorImageIOFactory.cpp IODataStructures/TensorImages/mitkNrrdTensorImageWriterFactory.cpp IODataStructures/TensorImages/mitkTensorImage.cpp IODataStructures/TensorImages/mitkTensorImageSerializer.cpp # DataStructures -> FiberBundleX IODataStructures/FiberBundleX/mitkFiberBundleX.cpp IODataStructures/FiberBundleX/mitkFiberBundleXWriter.cpp IODataStructures/FiberBundleX/mitkFiberBundleXReader.cpp IODataStructures/FiberBundleX/mitkFiberBundleXIOFactory.cpp IODataStructures/FiberBundleX/mitkFiberBundleXWriterFactory.cpp IODataStructures/FiberBundleX/mitkFiberBundleXSerializer.cpp IODataStructures/FiberBundleX/mitkFiberBundleXThreadMonitor.cpp # DataStructures -> PlanarFigureComposite IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp # DataStructures -> Tbss IODataStructures/TbssImages/mitkTbssImageSource.cpp IODataStructures/TbssImages/mitkTbssRoiImageSource.cpp IODataStructures/TbssImages/mitkNrrdTbssImageReader.cpp IODataStructures/TbssImages/mitkNrrdTbssImageIOFactory.cpp IODataStructures/TbssImages/mitkNrrdTbssRoiImageReader.cpp IODataStructures/TbssImages/mitkNrrdTbssRoiImageIOFactory.cpp IODataStructures/TbssImages/mitkTbssImage.cpp IODataStructures/TbssImages/mitkTbssRoiImage.cpp IODataStructures/TbssImages/mitkNrrdTbssImageWriter.cpp IODataStructures/TbssImages/mitkNrrdTbssImageWriterFactory.cpp IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriter.cpp IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriterFactory.cpp IODataStructures/TbssImages/mitkTbssImporter.cpp # Rendering Rendering/vtkMaskedProgrammableGlyphFilter.cpp Rendering/mitkCompositeMapper.cpp Rendering/mitkVectorImageVtkGlyphMapper3D.cpp Rendering/vtkOdfSource.cxx Rendering/vtkThickPlane.cxx Rendering/mitkOdfNormalizationMethodProperty.cpp Rendering/mitkOdfScaleByProperty.cpp Rendering/mitkFiberBundleXMapper2D.cpp Rendering/mitkFiberBundleXMapper3D.cpp Rendering/mitkFiberBundleXThreadMonitorMapper3D.cpp Rendering/mitkTbssImageMapper.cpp Rendering/mitkPlanarCircleMapper3D.cpp Rendering/mitkPlanarPolygonMapper3D.cpp # Interactions Interactions/mitkFiberBundleInteractor.cpp # Algorithms Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.cpp Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.cpp Algorithms/mitkTractAnalyzer.cpp # Tractography Tractography/itkStochasticTractographyFilter.h ) set(H_FILES # Rendering Rendering/mitkDiffusionImageMapper.h Rendering/mitkTbssImageMapper.h Rendering/mitkOdfVtkMapper2D.h Rendering/mitkFiberBundleXMapper3D.h Rendering/mitkFiberBundleXMapper2D.h Rendering/mitkFiberBundleXThreadMonitorMapper3D.h Rendering/mitkPlanarCircleMapper3D.h Rendering/mitkPlanarPolygonMapper3D.h # Reconstruction Reconstruction/itkDiffusionQballReconstructionImageFilter.h Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h Reconstruction/itkAnalyticalDiffusionQballReconstructionImageFilter.h Reconstruction/itkPointShell.h Reconstruction/itkOrientationDistributionFunction.h Reconstruction/itkDiffusionIntravoxelIncoherentMotionReconstructionImageFilter.h Reconstruction/itkRegularizedIVIMLocalVariationImageFilter.h Reconstruction/itkRegularizedIVIMReconstructionFilter.h Reconstruction/itkRegularizedIVIMReconstructionSingleIteration.h # IO Datastructures IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h IODataStructures/TbssImages/mitkTbssImporter.h # DataStructures -> FiberBundleX IODataStructures/FiberBundleX/mitkFiberBundleX.h IODataStructures/FiberBundleX/mitkFiberBundleXWriter.h IODataStructures/FiberBundleX/mitkFiberBundleXReader.h IODataStructures/FiberBundleX/mitkFiberBundleXIOFactory.h IODataStructures/FiberBundleX/mitkFiberBundleXWriterFactory.h IODataStructures/FiberBundleX/mitkFiberBundleXSerializer.h IODataStructures/FiberBundleX/mitkFiberBundleXThreadMonitor.h # Tractography Tractography/itkGibbsTrackingFilter.h Tractography/itkStochasticTractographyFilter.h # Algorithms Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h Algorithms/itkTensorDerivedMeasurementsFilter.h Algorithms/itkBrainMaskExtractionImageFilter.h Algorithms/itkB0ImageExtractionImageFilter.h + Algorithms/itkB0ImageExtractionToSeparateImageFilter.h Algorithms/itkTensorImageToDiffusionImageFilter.h Algorithms/itkTensorToL2NormImageFilter.h Algorithms/itkTractDensityImageFilter.h Algorithms/itkTractsToFiberEndingsImageFilter.h Algorithms/itkTractsToRgbaImageFilter.h Algorithms/itkGaussianInterpolateImageFunction.h Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h Algorithms/itkDiffusionTensorPrincipleDirectionImageFilter.h Algorithms/itkCartesianToPolarVectorImageFilter.h Algorithms/itkPolarToCartesianVectorImageFilter.h Algorithms/itkDistanceMapFilter.h Algorithms/itkProjectionFilter.h Algorithms/itkSkeletonizationFilter.h Algorithms/itkReduceDirectionGradientsFilter.h Algorithms/itkResidualImageFilter.h ) set( TOOL_FILES ) if(WIN32) endif(WIN32) #MITK_MULTIPLEX_PICTYPE( Algorithms/mitkImageRegistrationMethod-TYPE.cpp ) diff --git a/Modules/DiffusionImaging/files.cmake~ b/Modules/DiffusionImaging/files.cmake~ deleted file mode 100644 index 961349c228..0000000000 --- a/Modules/DiffusionImaging/files.cmake~ +++ /dev/null @@ -1,180 +0,0 @@ -SET(CPP_FILES - - # DicomImport - DicomImport/mitkDicomDiffusionImageReader.cpp - DicomImport/mitkGroupDiffusionHeadersFilter.cpp - DicomImport/mitkDicomDiffusionImageHeaderReader.cpp - DicomImport/mitkGEDicomDiffusionImageHeaderReader.cpp - DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.cpp - DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.cpp - DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.cpp - - # DataStructures - IODataStructures/mitkDiffusionImagingObjectFactory.cpp - - # DataStructures -> DWI - IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.cpp - IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSource.cpp - IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageReader.cpp - IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.cpp - IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageIOFactory.cpp - IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriterFactory.cpp - IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp - - # DataStructures -> QBall - IODataStructures/QBallImages/mitkQBallImageSource.cpp - IODataStructures/QBallImages/mitkNrrdQBallImageReader.cpp - IODataStructures/QBallImages/mitkNrrdQBallImageWriter.cpp - IODataStructures/QBallImages/mitkNrrdQBallImageIOFactory.cpp - IODataStructures/QBallImages/mitkNrrdQBallImageWriterFactory.cpp - IODataStructures/QBallImages/mitkQBallImage.cpp - IODataStructures/QBallImages/mitkQBallImageSerializer.cpp - - # DataStructures -> Tensor - IODataStructures/TensorImages/mitkTensorImageSource.cpp - IODataStructures/TensorImages/mitkNrrdTensorImageReader.cpp - IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp - IODataStructures/TensorImages/mitkNrrdTensorImageIOFactory.cpp - IODataStructures/TensorImages/mitkNrrdTensorImageWriterFactory.cpp - IODataStructures/TensorImages/mitkTensorImage.cpp - IODataStructures/TensorImages/mitkTensorImageSerializer.cpp - - # DataStructures -> FiberBundle - IODataStructures/FiberBundle/mitkFiberBundle.cpp - IODataStructures/FiberBundle/mitkFiberBundleWriter.cpp - IODataStructures/FiberBundle/mitkFiberBundleReader.cpp - IODataStructures/FiberBundle/mitkFiberBundleIOFactory.cpp - IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.cpp - IODataStructures/FiberBundle/mitkFiberBundleSerializer.cpp - IODataStructures/FiberBundle/mitkParticle.cpp - IODataStructures/FiberBundle/mitkParticleGrid.cpp - -# DataStructures -> FiberBundleX - IODataStructures/FiberBundleX/mitkFiberBundleX.cpp - IODataStructures/FiberBundleX/mitkFiberBundleXWriter.cpp - IODataStructures/FiberBundleX/mitkFiberBundleXReader.cpp - IODataStructures/FiberBundleX/mitkFiberBundleXIOFactory.cpp - IODataStructures/FiberBundleX/mitkFiberBundleXWriterFactory.cpp - IODataStructures/FiberBundleX/mitkFiberBundleXSerializer.cpp - IODataStructures/FiberBundleX/mitkFiberBundleXThreadMonitor.cpp - - - # DataStructures -> PlanarFigureComposite - IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp - - - # DataStructures -> Tbss - IODataStructures/TbssImages/mitkTbssImageSource.cpp - IODataStructures/TbssImages/mitkTbssRoiImageSource.cpp - IODataStructures/TbssImages/mitkNrrdTbssImageReader.cpp - IODataStructures/TbssImages/mitkNrrdTbssImageIOFactory.cpp - IODataStructures/TbssImages/mitkNrrdTbssRoiImageReader.cpp - IODataStructures/TbssImages/mitkNrrdTbssRoiImageIOFactory.cpp - IODataStructures/TbssImages/mitkTbssImage.cpp - IODataStructures/TbssImages/mitkTbssRoiImage.cpp - IODataStructures/TbssImages/mitkNrrdTbssImageWriter.cpp - IODataStructures/TbssImages/mitkNrrdTbssImageWriterFactory.cpp - IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriter.cpp - IODataStructures/TbssImages/mitkNrrdTbssRoiImageWriterFactory.cpp - IODataStructures/TbssImages/mitkTbssImporter.cpp - - - # Rendering - Rendering/vtkMaskedProgrammableGlyphFilter.cpp - Rendering/mitkCompositeMapper.cpp - Rendering/mitkVectorImageVtkGlyphMapper3D.cpp - Rendering/vtkOdfSource.cxx - Rendering/vtkThickPlane.cxx - Rendering/mitkOdfNormalizationMethodProperty.cpp - Rendering/mitkOdfScaleByProperty.cpp - Rendering/mitkFiberBundleMapper2D.cpp - Rendering/mitkFiberBundleMapper3D.cpp - Rendering/mitkFiberBundleXMapper2D.cpp - Rendering/mitkFiberBundleXMapper3D.cpp - Rendering/mitkFiberBundleXThreadMonitorMapper3D.cpp - Rendering/mitkTbssImageMapper.cpp - Rendering/mitkPlanarCircleMapper3D.cpp - Rendering/mitkPlanarPolygonMapper3D.cpp - -# Interactions - Interactions/mitkFiberBundleInteractor.cpp - - # Algorithms - Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.cpp - Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.cpp - - # Tractography - Tractography/itkStochasticTractographyFilter.h -) - -SET(H_FILES - # Rendering - Rendering/mitkDiffusionImageMapper.h - Rendering/mitkTbssImageMapper.h - Rendering/mitkOdfVtkMapper2D.h - Rendering/mitkFiberBundleMapper2D.h - Rendering/mitkFiberBundleMapper3D.h - Rendering/mitkFiberBundleXMapper3D.h - Rendering/mitkFiberBundleXMapper2D.h - Rendering/mitkFiberBundleXThreadMonitorMapper3D.h - Rendering/mitkPlanarCircleMapper3D.h - Rendering/mitkPlanarPolygonMapper3D.h - - # Reconstruction - Reconstruction/itkDiffusionQballReconstructionImageFilter.h - Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h - Reconstruction/itkAnalyticalDiffusionQballReconstructionImageFilter.h - Reconstruction/itkPointShell.h - Reconstruction/itkOrientationDistributionFunction.h - Reconstruction/itkDiffusionIntravoxelIncoherentMotionReconstructionImageFilter.h - Reconstruction/itkRegularizedIVIMLocalVariationImageFilter.h - Reconstruction/itkRegularizedIVIMReconstructionFilter.h - Reconstruction/itkRegularizedIVIMReconstructionSingleIteration.h - - # IO Datastructures - IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h - IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.h - - # DataStructures -> FiberBundleX - IODataStructures/FiberBundleX/mitkFiberBundleX.h - IODataStructures/FiberBundleX/mitkFiberBundleXWriter.h - IODataStructures/FiberBundleX/mitkFiberBundleXReader.h - IODataStructures/FiberBundleX/mitkFiberBundleXIOFactory.h - IODataStructures/FiberBundleX/mitkFiberBundleXWriterFactory.h - IODataStructures/FiberBundleX/mitkFiberBundleXSerializer.h - IODataStructures/FiberBundleX/mitkFiberBundleXThreadMonitor.h - - - - # Tractography - Tractography/itkGibbsTrackingFilter.h - Tractography/itkStochasticTractographyFilter.h - - # Algorithms - Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h - Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h - Algorithms/itkTensorDerivedMeasurementsFilter.h - Algorithms/itkBrainMaskExtractionImageFilter.h - Algorithms/itkB0ImageExtractionImageFilter.h - Algorithms/itkTensorImageToDiffusionImageFilter.h - Algorithms/itkTensorToL2NormImageFilter.h - Algorithms/itkTractsToProbabilityImageFilter.h - Algorithms/itkTractsToFiberEndingsImageFilter.h - Algorithms/itkGaussianInterpolateImageFunction.h - Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h - Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h - Algorithms/itkDiffusionTensorPrincipleDirectionImageFilter.h - Algorithms/itkCartesianToPolarVectorImageFilter.h - Algorithms/itkPolarToCartesianVectorImageFilter.h - Algorithms/itkDistanceMapFilter.h - Algorithms/itkProjectionFilter.h - Algorithms/itkSkeletonizationFilter.h -) - -SET( TOOL_FILES -) - -IF(WIN32) -ENDIF(WIN32) - -#MITK_MULTIPLEX_PICTYPE( Algorithms/mitkImageRegistrationMethod-TYPE.cpp ) diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.cpp b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.cpp index 5f2faba9bb..adda94ba43 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.cpp +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.cpp @@ -1,553 +1,595 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Module: $RCSfile$ Language: C++ Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $ Version: $Revision: 17495 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ //#define MBILOG_ENABLE_DEBUG #include "QmitkPreprocessingView.h" #include "mitkDiffusionImagingConfigure.h" // qt includes #include // itk includes #include "itkTimeProbe.h" #include "itkB0ImageExtractionImageFilter.h" +#include "itkB0ImageExtractionToSeparateImageFilter.h" #include "itkBrainMaskExtractionImageFilter.h" #include "itkCastImageFilter.h" #include "itkVectorContainer.h" #include // mitk includes #include "QmitkDataStorageComboBox.h" #include "QmitkStdMultiWidget.h" #include "mitkProgressBar.h" #include "mitkStatusBar.h" #include "mitkNodePredicateDataType.h" #include "mitkProperties.h" #include "mitkVtkResliceInterpolationProperty.h" #include "mitkLookupTable.h" #include "mitkLookupTableProperty.h" #include "mitkTransferFunction.h" #include "mitkTransferFunctionProperty.h" #include "mitkDataNodeObject.h" #include "mitkOdfNormalizationMethodProperty.h" #include "mitkOdfScaleByProperty.h" #include #include "berryIStructuredSelection.h" #include "berryIWorkbenchWindow.h" #include "berryISelectionService.h" #include #include const std::string QmitkPreprocessingView::VIEW_ID = "org.mitk.views.preprocessing"; #define DI_INFO MITK_INFO("DiffusionImaging") typedef float TTensorPixelType; using namespace berry; struct PrpSelListener : ISelectionListener { berryObjectMacro(PrpSelListener); PrpSelListener(QmitkPreprocessingView* view) { m_View = view; } void DoSelectionChanged(ISelection::ConstPointer selection) { // save current selection in member variable m_View->m_CurrentSelection = selection.Cast(); // do something with the selected items if(m_View->m_CurrentSelection) { bool foundDwiVolume = false; m_View->m_DiffusionImage = NULL; // iterate selection for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin(); i != m_View->m_CurrentSelection->End(); ++i) { // extract datatree node if (mitk::DataNodeObject::Pointer nodeObj = i->Cast()) { mitk::DataNode::Pointer node = nodeObj->GetDataNode(); // only look at interesting types if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0) { foundDwiVolume = true; m_View->m_DiffusionImage = dynamic_cast*>(node->GetData()); } } } m_View->m_Controls->m_ButtonBrainMask->setEnabled(foundDwiVolume); m_View->m_Controls->m_ButtonAverageGradients->setEnabled(foundDwiVolume); m_View->m_Controls->m_ButtonExtractB0->setEnabled(foundDwiVolume); m_View->m_Controls->m_ModifyMeasurementFrame->setEnabled(foundDwiVolume); m_View->m_Controls->m_MeasurementFrameTable->setEnabled(foundDwiVolume); m_View->m_Controls->m_ReduceGradientsButton->setEnabled(foundDwiVolume); m_View->m_Controls->m_ShowGradientsButton->setEnabled(foundDwiVolume); m_View->m_Controls->m_MirrorGradientToHalfSphereButton->setEnabled(foundDwiVolume); if (foundDwiVolume) { vnl_matrix_fixed< double, 3, 3 > mf = m_View->m_DiffusionImage->GetMeasurementFrame(); for (int r=0; r<3; r++) for (int c=0; c<3; c++) { QTableWidgetItem* item = m_View->m_Controls->m_MeasurementFrameTable->item(r,c); delete item; item = new QTableWidgetItem(); item->setTextAlignment(Qt::AlignCenter | Qt::AlignVCenter); item->setText(QString::number(mf.get(r,c))); m_View->m_Controls->m_MeasurementFrameTable->setItem(r,c,item); } m_View->m_Controls->m_GradientsLabel->setText(QString::number(m_View->m_DiffusionImage->GetNumDirections())); if (m_View->m_DiffusionImage->IsMultiBval()) m_View->m_Controls->m_BvalLabel->setText("Acquisition with multiple b-values!"); else m_View->m_Controls->m_BvalLabel->setText(QString::number(m_View->m_DiffusionImage->GetB_Value())); } else { for (int r=0; r<3; r++) for (int c=0; c<3; c++) { QTableWidgetItem* item = m_View->m_Controls->m_MeasurementFrameTable->item(r,c); delete item; item = new QTableWidgetItem(); m_View->m_Controls->m_MeasurementFrameTable->setItem(r,c,item); } m_View->m_Controls->m_GradientsLabel->setText("-"); m_View->m_Controls->m_BvalLabel->setText("-"); } } } void SelectionChanged(IWorkbenchPart::Pointer part, ISelection::ConstPointer selection) { // check, if selection comes from datamanager if (part) { QString partname(part->GetPartName().c_str()); if(partname.compare("Datamanager")==0) { // apply selection DoSelectionChanged(selection); } } } QmitkPreprocessingView* m_View; }; QmitkPreprocessingView::QmitkPreprocessingView() : QmitkFunctionality(), m_Controls(NULL), m_MultiWidget(NULL), m_DiffusionImage(NULL) { } QmitkPreprocessingView::QmitkPreprocessingView(const QmitkPreprocessingView& other) { Q_UNUSED(other) throw std::runtime_error("Copy constructor not implemented"); } QmitkPreprocessingView::~QmitkPreprocessingView() { this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->RemovePostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener); } void QmitkPreprocessingView::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widgets m_Controls = new Ui::QmitkPreprocessingViewControls; m_Controls->setupUi(parent); this->CreateConnections(); m_Controls->m_MeasurementFrameTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch); m_Controls->m_MeasurementFrameTable->verticalHeader()->setResizeMode(QHeaderView::Stretch); } m_SelListener = berry::ISelectionListener::Pointer(new PrpSelListener(this)); this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener); berry::ISelection::ConstPointer sel( this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager")); m_CurrentSelection = sel.Cast(); m_SelListener.Cast()->DoSelectionChanged(sel); } void QmitkPreprocessingView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) { m_MultiWidget = &stdMultiWidget; } void QmitkPreprocessingView::StdMultiWidgetNotAvailable() { m_MultiWidget = NULL; } void QmitkPreprocessingView::CreateConnections() { if ( m_Controls ) { connect( (QObject*)(m_Controls->m_ButtonAverageGradients), SIGNAL(clicked()), this, SLOT(AverageGradients()) ); connect( (QObject*)(m_Controls->m_ButtonExtractB0), SIGNAL(clicked()), this, SLOT(ExtractB0()) ); connect( (QObject*)(m_Controls->m_ButtonBrainMask), SIGNAL(clicked()), this, SLOT(BrainMask()) ); connect( (QObject*)(m_Controls->m_ModifyMeasurementFrame), SIGNAL(clicked()), this, SLOT(DoApplyMesurementFrame()) ); connect( (QObject*)(m_Controls->m_ReduceGradientsButton), SIGNAL(clicked()), this, SLOT(DoReduceGradientDirections()) ); connect( (QObject*)(m_Controls->m_ShowGradientsButton), SIGNAL(clicked()), this, SLOT(DoShowGradientDirections()) ); connect( (QObject*)(m_Controls->m_MirrorGradientToHalfSphereButton), SIGNAL(clicked()), this, SLOT(DoHalfSphereGradientDirections()) ); } } void QmitkPreprocessingView::Activated() { QmitkFunctionality::Activated(); berry::ISelection::ConstPointer sel( this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager")); m_CurrentSelection = sel.Cast(); m_SelListener.Cast()->DoSelectionChanged(sel); } void QmitkPreprocessingView::Deactivated() { QmitkFunctionality::Deactivated(); } void QmitkPreprocessingView::DoHalfSphereGradientDirections() { if (m_DiffusionImage.IsNull()) return; GradientDirectionContainerType::Pointer gradientContainer = m_DiffusionImage->GetOriginalDirections(); for (int j=0; jSize(); j++) if (gradientContainer->at(j)[0]<0) gradientContainer->at(j) = -gradientContainer->at(j); } void QmitkPreprocessingView::DoApplyMesurementFrame() { if (m_DiffusionImage.IsNull()) return; vnl_matrix_fixed< double, 3, 3 > mf; for (int r=0; r<3; r++) for (int c=0; c<3; c++) { QTableWidgetItem* item = m_Controls->m_MeasurementFrameTable->item(r,c); if (!item) return; mf[r][c] = item->text().toDouble(); } m_DiffusionImage->SetMeasurementFrame(mf); } void QmitkPreprocessingView::DoShowGradientDirections() { if (m_DiffusionImage.IsNull()) return; GradientDirectionContainerType::Pointer gradientContainer = m_DiffusionImage->GetOriginalDirections(); mitk::PointSet::Pointer pointset = mitk::PointSet::New(); for (int j=0; jSize(); j++) { mitk::Point3D p; vnl_vector_fixed< double, 3 > v = gradientContainer->at(j); if (fabs(v[0])>0.001 || fabs(v[1])>0.001 || fabs(v[2])>0.001) { p[0] = v[0]; p[1] = v[1]; p[2] = v[2]; pointset->InsertPoint(j, p); } } mitk::DataNode::Pointer node = mitk::DataNode::New(); node->SetData(pointset); node->SetName("gradient directions"); node->SetProperty("pointsize", mitk::FloatProperty::New(0.05)); node->SetProperty("color", mitk::ColorProperty::New(1,0,0)); GetDefaultDataStorage()->Add(node); } void QmitkPreprocessingView::DoReduceGradientDirections() { if (m_DiffusionImage.IsNull()) return; typedef mitk::DiffusionImage DiffusionImageType; typedef itk::ReduceDirectionGradientsFilter FilterType; GradientDirectionContainerType::Pointer gradientContainer = m_DiffusionImage->GetOriginalDirections(); FilterType::Pointer filter = FilterType::New(); filter->SetInput(m_DiffusionImage->GetVectorImage()); filter->SetOriginalGradientDirections(gradientContainer); filter->SetNumGradientDirections(m_Controls->m_ReduceGradientsBox->value()); filter->Update(); DiffusionImageType::Pointer image = DiffusionImageType::New(); image->SetVectorImage( filter->GetOutput() ); image->SetB_Value(m_DiffusionImage->GetB_Value()); image->SetDirections(filter->GetGradientDirections()); image->SetOriginalDirections(filter->GetGradientDirections()); image->SetMeasurementFrame(m_DiffusionImage->GetMeasurementFrame()); image->InitializeFromVectorImage(); mitk::DataNode::Pointer imageNode = mitk::DataNode::New(); imageNode->SetData( image ); imageNode->SetName("reduced_image"); GetDefaultDataStorage()->Add(imageNode); } void QmitkPreprocessingView::ExtractB0() { if (m_CurrentSelection) { mitk::DataStorage::SetOfObjects::Pointer set = mitk::DataStorage::SetOfObjects::New(); int at = 0; for (IStructuredSelection::iterator i = m_CurrentSelection->Begin(); i != m_CurrentSelection->End(); ++i) { if (mitk::DataNodeObject::Pointer nodeObj = i->Cast()) { mitk::DataNode::Pointer node = nodeObj->GetDataNode(); if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0) { set->InsertElement(at++, node); } } } // call the extraction withou averaging if the check-box is checked if( this->m_Controls->m_CheckExtractAll->isChecked() ) { DoExtractBOWithoutAveraging(set); } // call the avereging method otherwise else { DoExtractB0(set); } } } void QmitkPreprocessingView::DoExtractB0 (mitk::DataStorage::SetOfObjects::Pointer inImages) { typedef mitk::DiffusionImage DiffusionImageType; typedef DiffusionImageType::GradientDirectionContainerType GradientContainerType; int nrFiles = inImages->size(); if (!nrFiles) return; mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() ); mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() ); std::vector nodes; while ( itemiter != itemiterend ) // for all items { DiffusionImageType* vols = static_cast( (*itemiter)->GetData()); std::string nodename; (*itemiter)->GetStringProperty("name", nodename); // Extract image using found index typedef itk::B0ImageExtractionImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(vols->GetVectorImage()); filter->SetDirections(vols->GetDirections()); filter->Update(); mitk::Image::Pointer mitkImage = mitk::Image::New(); mitkImage->InitializeByItk( filter->GetOutput() ); mitkImage->SetVolume( filter->GetOutput()->GetBufferPointer() ); mitk::DataNode::Pointer node=mitk::DataNode::New(); node->SetData( mitkImage ); node->SetProperty( "name", mitk::StringProperty::New(nodename + "_B0")); GetDefaultDataStorage()->Add(node); ++itemiter; } } void QmitkPreprocessingView::DoExtractBOWithoutAveraging( mitk::DataStorage::SetOfObjects::Pointer inputImageSet ) { + // typedefs + typedef mitk::DiffusionImage DiffusionImageType; + typedef DiffusionImageType::GradientDirectionContainerType GradientContainerType; + typedef itk::B0ImageExtractionToSeparateImageFilter< short, short> FilterType; + + // check number of selected objects, return if empty + int nrFiles = inputImageSet->size(); + if (!nrFiles) + return; + + mitk::DataStorage::SetOfObjects::const_iterator itemiter( inputImageSet->begin() ); + mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inputImageSet->end() ); + + std::vector< mitk::DataNode::Pointer > nodes; + + while ( itemiter != itemiterend ) // for all items + { + DiffusionImageType* vols = + static_cast( + (*itemiter)->GetData()); + + std::string nodename; + (*itemiter)->GetStringProperty("name", nodename); + + // Extract image using found index + FilterType::Pointer filter = FilterType::New(); + filter->SetInput(vols->GetVectorImage()); + filter->SetDirections(vols->GetDirections()); + filter->Update(); + + mitk::Image::Pointer mitkImage = mitk::Image::New(); + mitkImage->InitializeByItk( filter->GetOutput() ); + mitkImage->SetVolume( filter->GetOutput()->GetBufferPointer() ); + mitk::DataNode::Pointer node=mitk::DataNode::New(); + node->SetData( mitkImage ); + node->SetProperty( "name", mitk::StringProperty::New(nodename + "_B0_ALL")); + + GetDefaultDataStorage()->Add(node); + + ++itemiter; + } } void QmitkPreprocessingView::AverageGradients() { if (m_CurrentSelection) { mitk::DataStorage::SetOfObjects::Pointer set = mitk::DataStorage::SetOfObjects::New(); int at = 0; for (IStructuredSelection::iterator i = m_CurrentSelection->Begin(); i != m_CurrentSelection->End(); ++i) { if (mitk::DataNodeObject::Pointer nodeObj = i->Cast()) { mitk::DataNode::Pointer node = nodeObj->GetDataNode(); if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0) { set->InsertElement(at++, node); } } } DoAverageGradients(set); } } void QmitkPreprocessingView::DoAverageGradients (mitk::DataStorage::SetOfObjects::Pointer inImages) { int nrFiles = inImages->size(); if (!nrFiles) return; mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() ); mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() ); std::vector nodes; while ( itemiter != itemiterend ) // for all items { mitk::DiffusionImage* vols = static_cast*>( (*itemiter)->GetData()); vols->AverageRedundantGradients(m_Controls->m_Blur->value()); ++itemiter; } } void QmitkPreprocessingView::BrainMask() { if (m_CurrentSelection) { mitk::DataStorage::SetOfObjects::Pointer set = mitk::DataStorage::SetOfObjects::New(); int at = 0; for (IStructuredSelection::iterator i = m_CurrentSelection->Begin(); i != m_CurrentSelection->End(); ++i) { if (mitk::DataNodeObject::Pointer nodeObj = i->Cast()) { mitk::DataNode::Pointer node = nodeObj->GetDataNode(); if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0) { set->InsertElement(at++, node); } } } DoBrainMask(set); } } void QmitkPreprocessingView::DoBrainMask (mitk::DataStorage::SetOfObjects::Pointer inImages) { int nrFiles = inImages->size(); if (!nrFiles) return; mitk::DataStorage::SetOfObjects::const_iterator itemiter( inImages->begin() ); mitk::DataStorage::SetOfObjects::const_iterator itemiterend( inImages->end() ); while ( itemiter != itemiterend ) // for all items { mitk::DiffusionImage* vols = static_cast*>( (*itemiter)->GetData()); std::string nodename; (*itemiter)->GetStringProperty("name", nodename); // Extract image using found index typedef itk::B0ImageExtractionImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetInput(vols->GetVectorImage()); filter->SetDirections(vols->GetDirections()); typedef itk::CastImageFilter, itk::Image > CastFilterType; CastFilterType::Pointer castfilter = CastFilterType::New(); castfilter->SetInput(filter->GetOutput()); typedef itk::BrainMaskExtractionImageFilter MaskFilterType; MaskFilterType::Pointer maskfilter = MaskFilterType::New(); maskfilter->SetInput(castfilter->GetOutput()); maskfilter->Update(); mitk::Image::Pointer mitkImage = mitk::Image::New(); mitkImage->InitializeByItk( maskfilter->GetOutput() ); mitkImage->SetVolume( maskfilter->GetOutput()->GetBufferPointer() ); mitk::DataNode::Pointer node=mitk::DataNode::New(); node->SetData( mitkImage ); node->SetProperty( "name", mitk::StringProperty::New(nodename + "_Mask")); GetDefaultDataStorage()->Add(node); ++itemiter; } }