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/itkB0ImageExtractionImageFilter.txx b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.txx index 966cf87cbe..9e80f6288f 100644 --- a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.txx +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionImageFilter.txx @@ -1,118 +1,119 @@ /*========================================================================= Program: Insight Segmentation & Registration Toolkit Language: C++ Date: $Date: 2006-07-19 15:11:41 $ Version: $Revision: 1.11 $ Copyright (c) Insight Software Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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_txx #define __itkB0ImageExtractionImageFilter_txx #include "itkB0ImageExtractionImageFilter.h" + namespace itk { template< class TInputImagePixelType, class TOutputImagePixelType > B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType > ::B0ImageExtractionImageFilter() { // At least 1 inputs is necessary for a vector image. // For images added one at a time we need at least six this->SetNumberOfRequiredInputs( 1 ); } template< class TInputImagePixelType, class TOutputImagePixelType > void B0ImageExtractionImageFilter< TInputImagePixelType, TOutputImagePixelType > ::GenerateData() { typename GradientDirectionContainerType::Iterator begin = m_Directions->Begin(); typename GradientDirectionContainerType::Iterator end = m_Directions->End(); // Find the index of the b0 image std::vector indices; int index = 0; while(begin!=end) { GradientDirectionType grad = begin->Value(); if(grad[0] == 0 && grad[1] == 0 && grad[2] == 0) { indices.push_back(index); } ++index; ++begin; } typedef itk::Image TempImageType; TempImageType::Pointer tmp = TempImageType::New(); typename TempImageType::RegionType region = this->GetInput()->GetLargestPossibleRegion(); tmp->SetSpacing(this->GetInput()->GetSpacing()); tmp->SetOrigin(this->GetInput()->GetOrigin()); tmp->SetDirection(this->GetInput()->GetDirection()); tmp->SetRegions(region); tmp->Allocate(); itk::ImageRegionIterator it(tmp.GetPointer(), tmp->GetLargestPossibleRegion() ); itk::ImageRegionConstIterator vectorIt(this->GetInput(), this->GetInput()->GetLargestPossibleRegion() ); it.GoToBegin(); while(!it.IsAtEnd()) { it.Set(0); ++it; } //Sum all images that have zero diffusion weighting (indices stored in vector index) for(std::vector::iterator indexIt = indices.begin(); indexIt != indices.end(); indexIt++) { it.GoToBegin(); vectorIt.GoToBegin(); while(!it.IsAtEnd() && !vectorIt.IsAtEnd()) { typename InputImageType::PixelType vec = vectorIt.Get(); it.Set((1.0 * it.Get()) + (1.0 * vec[*indexIt]) / (1.0 * indices.size())); ++it; ++vectorIt; } } typename OutputImageType::Pointer b0Image = static_cast< OutputImageType * >(this->ProcessObject::GetOutput(0)); typename OutputImageType::RegionType outregion = this->GetInput()->GetLargestPossibleRegion(); b0Image->SetSpacing(this->GetInput()->GetSpacing()); b0Image->SetOrigin(this->GetInput()->GetOrigin()); b0Image->SetDirection(this->GetInput()->GetDirection()); b0Image->SetRegions(outregion); b0Image->Allocate(); itk::ImageRegionIterator itIn(tmp, tmp->GetLargestPossibleRegion() ); itk::ImageRegionIterator itOut(b0Image, b0Image->GetLargestPossibleRegion() ); itIn.GoToBegin(); itOut.GoToBegin(); while(!itIn.IsAtEnd()) { itOut.Set(itIn.Get()); ++itIn; ++itOut; } } } #endif // __itkB0ImageExtractionImageFilter_txx diff --git a/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h new file mode 100644 index 0000000000..25d5223342 --- /dev/null +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.h @@ -0,0 +1,107 @@ +/*========================================================================= + +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 "itkImageToImageFilter.h" + +namespace itk +{ +/** \class B0ImageExtractionToSeparateImageFilter + \brief This class has an advanced functionality to the B0ImageExtractionImageFilter, however the b0 images are + stored in a 3D+t image with each b0 image beeing a separate timestep and not averaged to a single 3D volume + */ + +template< class TInputImagePixelType, + class TOutputImagePixelType > +class B0ImageExtractionToSeparateImageFilter : + public ImageToImageFilter< VectorImage, + Image< TOutputImagePixelType, 4 > > +{ +public: + + typedef B0ImageExtractionToSeparateImageFilter Self; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + typedef TInputImagePixelType InputPixelType; + typedef TOutputImagePixelType OutputPixelType; + + typedef ImageToImageFilter< VectorImage, + Image< TOutputImagePixelType, 4 > > Superclass; + + /** typedefs from superclass */ + typedef typename Superclass::InputImageType InputImageType; + //typedef typename Superclass::OutputImageType OutputImageType; + typedef Image< TOutputImagePixelType, 4 > OutputImageType; + + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef vnl_vector_fixed< double, 3 > GradientDirectionType; + + typedef itk::VectorContainer< unsigned int, GradientDirectionType > + GradientDirectionContainerType; + + typedef typename GradientDirectionContainerType::Iterator GradContainerIteratorType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Runtime information support. */ + itkTypeMacro(B0ImageExtractionToSeparateImageFilter, + ImageToImageFilter); + + GradientDirectionContainerType::Pointer GetDirections() + { + return m_Directions; + } + + void SetDirections( GradientDirectionContainerType::Pointer directions ) + { + this->m_Directions = directions; + } + +protected: + + B0ImageExtractionToSeparateImageFilter(); + virtual ~B0ImageExtractionToSeparateImageFilter(){}; + + void GenerateData(); + + /** The dimension of the output does not match the dimension of the input + hence we need to re-implement the CopyInformation method to avoid + executing the default implementation which tries to copy the input information to the + output + */ + virtual void CopyInformation( const DataObject *data); + + /** Override of the ProcessObject::GenerateOutputInformation() because of different + dimensionality of the input and the output + */ + virtual void GenerateOutputInformation(); + + GradientDirectionContainerType::Pointer m_Directions; +}; + +} // 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..c466fb1bb3 --- /dev/null +++ b/Modules/DiffusionImaging/Algorithms/itkB0ImageExtractionToSeparateImageFilter.txx @@ -0,0 +1,163 @@ +/*========================================================================= + +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() +{ + this->SetNumberOfRequiredInputs( 1 ); +} + +template< class TInputImagePixelType, + class TOutputImagePixelType> +void itk::B0ImageExtractionToSeparateImageFilter< +TInputImagePixelType, TOutputImagePixelType >::CopyInformation( const DataObject *data) +{ + +} + +template< class TInputImagePixelType, + class TOutputImagePixelType> +void itk::B0ImageExtractionToSeparateImageFilter< +TInputImagePixelType, TOutputImagePixelType >::GenerateOutputInformation() +{ + +} + +template< class TInputImagePixelType, + class TOutputImagePixelType> +void itk::B0ImageExtractionToSeparateImageFilter< +TInputImagePixelType, TOutputImagePixelType >::GenerateData() +{ + + GradContainerIteratorType begin = m_Directions->Begin(); + GradContainerIteratorType end = m_Directions->End(); + + // Find the indices of the b0 images in the diffusion image + std::vector indices; + int index = 0; + while(begin!=end) + { + GradientDirectionType grad = begin->Value(); + + if(grad[0] == 0 && grad[1] == 0 && grad[2] == 0) + { + indices.push_back(index); + } + ++index; + ++begin; + } + + // declare the output image + // this will have the b0 images stored as timesteps + typename OutputImageType::Pointer outputImage = this->GetOutput(); + //OutputImageType::New(); + + // get the input region + typename Superclass::InputImageType::RegionType inputRegion = + this->GetInput()->GetLargestPossibleRegion(); + + // allocate image with + // - dimension: [DimX, DimY, DimZ, NumOfb0 ] + // - spacing: old one, 1.0 time + + typename OutputImageType::SpacingType spacing; + spacing.Fill(1); + + typename OutputImageType::PointType origin; + origin.Fill(0); + + OutputImageRegionType outputRegion; + + // the spacing and origin corresponds to the respective values in the input image (3D) + // the same for the region + for (unsigned int i=0; i< 3; i++) + { + spacing[i] = (this->GetInput()->GetSpacing())[i]; + origin[i] = (this->GetInput()->GetOrigin())[i]; + outputRegion.SetSize(i, this->GetInput()->GetLargestPossibleRegion().GetSize()[i]); + outputRegion.SetIndex(i, this->GetInput()->GetLargestPossibleRegion().GetIndex()[i]); + } + + // number of timesteps = number of b0 images + outputRegion.SetSize(3, indices.size()); + outputRegion.SetIndex( 3, 0 ); + + // output image direction (4x4) + typename OutputImageType::DirectionType outputDirection; + //initialize to identity + outputDirection.SetIdentity(); + // get the input image direction ( 3x3 matrix ) + typename InputImageType::DirectionType inputDirection = this->GetInput()->GetDirection(); + + for( unsigned int i=0; i< 3; i++) + { + outputDirection(0,i) = inputDirection(0,i); + outputDirection(1,i) = inputDirection(1,i); + outputDirection(2,i) = inputDirection(2,i); + } + + outputImage->SetSpacing( spacing ); + outputImage->SetOrigin( origin ); + outputImage->SetDirection( outputDirection ); + outputImage->SetRegions( outputRegion ); + outputImage->Allocate(); + + // input iterator + itk::ImageRegionConstIterator inputIt( this->GetInput(), this->GetInput()->GetLargestPossibleRegion() ); + + // we want to iterate separately over each 3D volume of the output image + // so reset the regions last dimension + outputRegion.SetSize(3,1); + unsigned int currentTimeStep = 0; + + + // extract b0 and insert them as a new time step + for(std::vector::iterator indexIt = indices.begin(); + indexIt != indices.end(); + indexIt++) + { + // set the time step + outputRegion.SetIndex(3, currentTimeStep); + itk::ImageRegionIterator< OutputImageType> outputIt( outputImage.GetPointer(), outputRegion ); + + // iterate over the current b0 image and store it to corresponding place + outputIt = outputIt.Begin(); + inputIt = inputIt.Begin(); + while( !outputIt.IsAtEnd() && !inputIt.IsAtEnd() ) + { + // the input vector + typename InputImageType::PixelType vec = inputIt.Get(); + + outputIt.Set( vec[*indexIt]); + ++outputIt; + ++inputIt; + } + + // increase time step + currentTimeStep++; + } + + +} + +#endif // ifndef __itkB0ImageExtractionToSeparateImageFilter_txx diff --git a/Modules/DiffusionImaging/files.cmake b/Modules/DiffusionImaging/files.cmake index ed47a8eb41..eac860f869 100644 --- a/Modules/DiffusionImaging/files.cmake +++ b/Modules/DiffusionImaging/files.cmake @@ -1,218 +1,219 @@ 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 # DataStructures Connectomics IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetwork.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkReader.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkIOFactory.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkSerializer.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriter.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriterFactory.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkDefinitions.cpp IODataStructures/ConnectomicsNetwork/mitkConnectomicsConstantsManager.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 Rendering/mitkConnectomicsNetworkMapper3D.cpp # Interactions Interactions/mitkFiberBundleInteractor.cpp # Algorithms Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.cpp Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.cpp Algorithms/mitkTractAnalyzer.cpp # Algorithms Connectomics Algorithms/Connectomics/mitkConnectomicsNetworkCreator.cpp Algorithms/Connectomics/mitkConnectomicsHistogramBase.cpp Algorithms/Connectomics/mitkConnectomicsDegreeHistogram.cpp Algorithms/Connectomics/mitkConnectomicsShortestPathHistogram.cpp Algorithms/Connectomics/mitkConnectomicsBetweennessHistogram.cpp Algorithms/Connectomics/mitkConnectomicsHistogramCache.cpp Algorithms/Connectomics/mitkConnectomicsSyntheticNetworkGenerator.cpp Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationBase.cpp Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationModularity.cpp Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingManager.cpp Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionBase.cpp Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.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 Rendering/mitkConnectomicsNetworkMapper3D.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 # Datastructures Connectomics IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetwork.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkReader.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkIOFactory.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkSerializer.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriter.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriterFactory.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkDefinitions.h IODataStructures/ConnectomicsNetwork/mitkConnectomicsConstantsManager.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 Algorithms/itkExtractChannelFromRgbaImageFilter.h # Algorithms Connectomics Algorithms/Connectomics/mitkConnectomicsNetworkCreator.h Algorithms/Connectomics/mitkConnectomicsHistogramBase.h Algorithms/Connectomics/mitkConnectomicsDegreeHistogram.h Algorithms/Connectomics/mitkConnectomicsShortestPathHistogram.h Algorithms/Connectomics/mitkConnectomicsBetweennessHistogram.h Algorithms/Connectomics/mitkConnectomicsHistogramCache.h Algorithms/Connectomics/mitkConnectomicsSyntheticNetworkGenerator.h Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationBase.h Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationModularity.h Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingManager.h Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionBase.h Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.h Algorithms/itkTensorReconstructionWithEigenvalueCorrectionFilter.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 eeb2a72a09..0000000000 --- a/Modules/DiffusionImaging/files.cmake~ +++ /dev/null @@ -1,219 +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 -> 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 - - # DataStructures Connectomics - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetwork.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkReader.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkIOFactory.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkSerializer.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriter.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriterFactory.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkDefinitions.cpp - IODataStructures/ConnectomicsNetwork/mitkConnectomicsConstantsManager.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 - Rendering/mitkConnectomicsNetworkMapper3D.cpp - -# Interactions - Interactions/mitkFiberBundleInteractor.cpp - - # Algorithms - Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.cpp - Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.cpp - Algorithms/mitkTractAnalyzer.cpp - - # Algorithms Connectomics - Algorithms/Connectomics/mitkConnectomicsNetworkCreator.cpp - Algorithms/Connectomics/mitkConnectomicsHistogramBase.cpp - Algorithms/Connectomics/mitkConnectomicsDegreeHistogram.cpp - Algorithms/Connectomics/mitkConnectomicsShortestPathHistogram.cpp - Algorithms/Connectomics/mitkConnectomicsBetweennessHistogram.cpp - Algorithms/Connectomics/mitkConnectomicsHistogramCache.cpp - Algorithms/Connectomics/mitkConnectomicsSyntheticNetworkGenerator.cpp - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationBase.cpp - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationModularity.cpp - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingManager.cpp - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionBase.cpp - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.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 - Rendering/mitkConnectomicsNetworkMapper3D.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 - - # Datastructures Connectomics - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetwork.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkReader.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkIOFactory.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkSerializer.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriter.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkWriterFactory.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsNetworkDefinitions.h - IODataStructures/ConnectomicsNetwork/mitkConnectomicsConstantsManager.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/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 -<<<<<<< HEAD - Algorithms/itkReduceDirectionGradientsFilter.h - Algorithms/itkResidualImageFilter.h - - # Algorithms Connectomics - Algorithms/Connectomics/mitkConnectomicsNetworkCreator.h - Algorithms/Connectomics/mitkConnectomicsHistogramBase.h - Algorithms/Connectomics/mitkConnectomicsDegreeHistogram.h - Algorithms/Connectomics/mitkConnectomicsShortestPathHistogram.h - Algorithms/Connectomics/mitkConnectomicsBetweennessHistogram.h - Algorithms/Connectomics/mitkConnectomicsHistogramCache.h - Algorithms/Connectomics/mitkConnectomicsSyntheticNetworkGenerator.h - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationBase.h - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingPermutationModularity.h - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingManager.h - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionBase.h - Algorithms/Connectomics/mitkConnectomicsSimulatedAnnealingCostFunctionModularity.h -======= - Algorithms/itkFreeWaterEliminationFilter.h ->>>>>>> origin/bug-10827-fwe -) - -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 e5d7925b30..7ad470e8eb 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.cpp +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.cpp @@ -1,388 +1,443 @@ /*========================================================================= 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 #include const std::string QmitkPreprocessingView::VIEW_ID = "org.mitk.views.preprocessing"; #define DI_INFO MITK_INFO("DiffusionImaging") typedef float TTensorPixelType; 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() { } 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); } } 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::OnSelectionChanged( std::vector nodes ) { bool foundDwiVolume = false; m_DiffusionImage = NULL; m_SelectedDiffusionNodes = mitk::DataStorage::SetOfObjects::New(); // iterate selection for( std::vector::iterator it = nodes.begin(); it != nodes.end(); ++it ) { mitk::DataNode::Pointer node = *it; if( node.IsNotNull() && dynamic_cast*>(node->GetData()) ) { foundDwiVolume = true; m_DiffusionImage = dynamic_cast*>(node->GetData()); m_Controls->m_DiffusionImageLabel->setText(node->GetName().c_str()); m_SelectedDiffusionNodes->push_back(node); } } m_Controls->m_ButtonBrainMask->setEnabled(foundDwiVolume); m_Controls->m_ButtonAverageGradients->setEnabled(foundDwiVolume); m_Controls->m_ButtonExtractB0->setEnabled(foundDwiVolume); + m_Controls->m_CheckExtractAll->setEnabled(foundDwiVolume); m_Controls->m_ModifyMeasurementFrame->setEnabled(foundDwiVolume); m_Controls->m_MeasurementFrameTable->setEnabled(foundDwiVolume); m_Controls->m_ReduceGradientsButton->setEnabled(foundDwiVolume); m_Controls->m_ShowGradientsButton->setEnabled(foundDwiVolume); m_Controls->m_MirrorGradientToHalfSphereButton->setEnabled(foundDwiVolume); if (foundDwiVolume) { vnl_matrix_fixed< double, 3, 3 > mf = m_DiffusionImage->GetMeasurementFrame(); for (int r=0; r<3; r++) for (int c=0; c<3; c++) { QTableWidgetItem* item = 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_Controls->m_MeasurementFrameTable->setItem(r,c,item); } m_Controls->m_GradientsLabel->setText(QString::number(m_DiffusionImage->GetNumDirections())); if (m_DiffusionImage->IsMultiBval()) m_Controls->m_BvalLabel->setText("Acquisition with multiple b-values!"); else m_Controls->m_BvalLabel->setText(QString::number(m_DiffusionImage->GetB_Value())); } else { for (int r=0; r<3; r++) for (int c=0; c<3; c++) { QTableWidgetItem* item = m_Controls->m_MeasurementFrameTable->item(r,c); delete item; item = new QTableWidgetItem(); m_Controls->m_MeasurementFrameTable->setItem(r,c,item); } m_Controls->m_GradientsLabel->setText("-"); m_Controls->m_BvalLabel->setText("-"); m_Controls->m_DiffusionImageLabel->setText("-"); } } void QmitkPreprocessingView::Activated() { QmitkFunctionality::Activated(); } 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() { typedef mitk::DiffusionImage DiffusionImageType; typedef DiffusionImageType::GradientDirectionContainerType GradientContainerType; int nrFiles = m_SelectedDiffusionNodes->size(); if (!nrFiles) return; + // call the extraction withou averaging if the check-box is checked + if( this->m_Controls->m_CheckExtractAll->isChecked() ) + { + DoExtractBOWithoutAveraging(); + return; + } + mitk::DataStorage::SetOfObjects::const_iterator itemiter( m_SelectedDiffusionNodes->begin() ); mitk::DataStorage::SetOfObjects::const_iterator itemiterend( m_SelectedDiffusionNodes->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() +{ + // 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 = m_SelectedDiffusionNodes->size(); + if (!nrFiles) + return; + + mitk::DataStorage::SetOfObjects::const_iterator itemiter( m_SelectedDiffusionNodes->begin() ); + mitk::DataStorage::SetOfObjects::const_iterator itemiterend( m_SelectedDiffusionNodes->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() { int nrFiles = m_SelectedDiffusionNodes->size(); if (!nrFiles) return; mitk::DataStorage::SetOfObjects::const_iterator itemiter( m_SelectedDiffusionNodes->begin() ); mitk::DataStorage::SetOfObjects::const_iterator itemiterend( m_SelectedDiffusionNodes->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() { int nrFiles = m_SelectedDiffusionNodes->size(); if (!nrFiles) return; mitk::DataStorage::SetOfObjects::const_iterator itemiter( m_SelectedDiffusionNodes->begin() ); mitk::DataStorage::SetOfObjects::const_iterator itemiterend( m_SelectedDiffusionNodes->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; } } diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.h b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.h index 1c449b4fa2..10a1ca5dfc 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.h +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingView.h @@ -1,107 +1,109 @@ /*========================================================================= 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. =========================================================================*/ #ifndef _QMITKPREPROCESSINGVIEW_H_INCLUDED #define _QMITKPREPROCESSINGVIEW_H_INCLUDED #include #include #include "ui_QmitkPreprocessingViewControls.h" #include "mitkDiffusionImage.h" typedef short DiffusionPixelType; struct PrpSelListener; /*! * \ingroup org_mitk_gui_qt_preprocessing_internal * * \brief QmitkPreprocessingView * * Document your class here. * * \sa QmitkFunctionality */ class QmitkPreprocessingView : public QmitkFunctionality { friend struct PrpSelListener; // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: static const std::string VIEW_ID; typedef vnl_vector_fixed< double, 3 > GradientDirectionType; typedef itk::VectorContainer< unsigned int, GradientDirectionType > GradientDirectionContainerType; QmitkPreprocessingView(); QmitkPreprocessingView(const QmitkPreprocessingView& other); virtual ~QmitkPreprocessingView(); virtual void CreateQtPartControl(QWidget *parent); /// \brief Creation of the connections of main and control widget virtual void CreateConnections(); /// \brief Called when the functionality is activated virtual void Activated(); virtual void Deactivated(); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); static const int nrconvkernels; protected slots: void AverageGradients(); void ExtractB0(); void BrainMask(); void DoApplyMesurementFrame(); void DoReduceGradientDirections(); void DoShowGradientDirections(); void DoHalfSphereGradientDirections(); protected: + /** Called by ExtractB0 if check-box activated, extracts all b0 images without averaging */ + void DoExtractBOWithoutAveraging(); /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged( std::vector nodes ); Ui::QmitkPreprocessingViewControls* m_Controls; QmitkStdMultiWidget* m_MultiWidget; void SetDefaultNodeProperties(mitk::DataNode::Pointer node, std::string name); mitk::DiffusionImage::Pointer m_DiffusionImage; mitk::DataStorage::SetOfObjects::Pointer m_SelectedDiffusionNodes; }; #endif // _QMITKPREPROCESSINGVIEW_H_INCLUDED diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingViewControls.ui b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingViewControls.ui index fd89ef86d2..c67d78669e 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingViewControls.ui +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkPreprocessingViewControls.ui @@ -1,519 +1,529 @@ QmitkPreprocessingViewControls 0 0 389 913 0 0 true QmitkPreprocessingViewControls Data Diffusion Image: - Info QFormLayout::AllNonFixedFieldsGrow Number of Gradients: - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter b-Value: - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter false Generate pointset displaying the gradient vectors. Show gradients Reduce size 0 70 Multiple acquistions of one gradient direction can be averaged. Due to rounding errors, similar gradients often differ in the last decimal positions. The Merge radius allows to average them anyway by taking into account all directions within a certain radius. true QFrame::NoFrame QFrame::Raised 0 Accumulates the information that was acquired with multiple repetitions for one gradient. Vectors do not have to be precisely equal in order to be merged, if a "Merge radius" > 0 is configured. Accumulates the information that was acquired with multiple repetitions for one gradient. Vectors do not have to be precisely equal in order to be merged, if a "Merge radius" > 0 is configured. Accumulates the information that was acquired with multiple repetitions for one gradient. Vectors do not have to be precisely equal in order to be merged, if a "Merge radius" > 0 is configured. 6 2.000000000000000 0.000100000000000 0.001000000000000 Accumulates the information that was acquired with multiple repetitions for one gradient. Vectors do not have to be precisely equal in order to be merged, if a "Merge radius" > 0 is configured. Accumulates the information that was acquired with multiple repetitions for one gradient. Vectors do not have to be precisely equal in order to be merged, if a "Merge radius" > 0 is configured. Accumulates the information that was acquired with multiple repetitions for one gradient. Vectors do not have to be precisely equal in order to be merged, if a "Merge radius" > 0 is configured. Merge radius false Average redundant gradients false Mirror all gradients around one axis. Mirror gradients to half sphere Qt::Horizontal QFrame::NoFrame QFrame::Raised 0 0 0 New number of gradients: 1 30 false Retain only the specified number of gradient directions and according image volumes. The retained directions are spread equally over the half sphere. Reduce number of gradients Non diffusion weighted image 0 30 Average and extract all images that were acquired without diffusion weighting. true false Extract B0 + + + + Create a 3D+t data set containing all b0 images as timesteps + + + Extract all B0 without averaging + + + Brain mask false Estimate binary brain mask 0 0 Measurment frame Qt::Horizontal 40 20 false 0 0 10 10 IBeamCursor true Qt::ScrollBarAlwaysOff Qt::ScrollBarAlwaysOff true false false true true false true true New Row New Row New Row New Column New Column New Column false Apply new mesurement frame Qt::Vertical 20 40