diff --git a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt index 7779479541..9cb5ee3c22 100644 --- a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt +++ b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt @@ -1,10 +1,10 @@ MITK_CREATE_MODULE( DiffusionCore SUBPROJECTS MITK-DTI INCLUDE_DIRS Algorithms Algorithms/Reconstruction Algorithms/Registration Algorithms/Reconstruction/MultishellProcessing DicomImport IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures Rendering ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS MitkMapperExt PlanarFigure ImageExtraction SceneSerializationBase + DEPENDS MitkMapperExt PlanarFigure ImageExtraction SceneSerializationBase DICOMReader PACKAGE_DEPENDS VTK|vtkFiltersProgrammable ITK|ITKDistanceMap+ITKRegistrationCommon+ITKLabelVoting+ITKVTK Boost WARNINGS_AS_ERRORS ) add_subdirectory(Testing) diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp index 8e684800ce..2b9cb7b927 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp @@ -1,245 +1,248 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkDiffusionDICOMFileReader.h" #include "mitkDiffusionDICOMFileReaderHelper.h" #include "mitkDiffusionHeaderSiemensDICOMFileReader.h" #include "mitkDiffusionHeaderSiemensMosaicDICOMFileReader.h" #include "mitkDiffusionHeaderGEDICOMFileReader.h" static void PerformHeaderAnalysis( mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType headers ) { unsigned int images = headers.size(); unsigned int unweighted_images = 0; unsigned int weighted_images = 0; mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType::const_iterator c_iter = headers.begin(); while( c_iter != headers.end() ) { const mitk::DiffusionImageDICOMHeaderInformation h = *c_iter; if( h.baseline ) unweighted_images++; if( h.b_value > 0 ) weighted_images++; ++c_iter; } MITK_INFO << " :: Analyzed volumes " << images << "\n" << " :: \t"<< unweighted_images << " b = 0" << "\n" << " :: \t"<< weighted_images << " b > 0"; } mitk::DiffusionDICOMFileReader::DiffusionDICOMFileReader() { } mitk::DiffusionDICOMFileReader::~DiffusionDICOMFileReader() { } bool mitk::DiffusionDICOMFileReader ::LoadImages() { // prepare data reading DiffusionDICOMFileReaderHelper helper; DiffusionDICOMFileReaderHelper::VolumeFileNamesContainer filenames; const size_t number_of_outputs = this->GetNumberOfOutputs(); for( size_t idx = 0; idx < number_of_outputs; idx++ ) { DICOMImageFrameList flist = this->GetOutput(idx).GetImageFrameList(); std::vector< std::string > FileNamesPerVolume; DICOMImageFrameList::const_iterator cIt = flist.begin(); while( cIt != flist.end() ) { FileNamesPerVolume.push_back( (*cIt)->Filename ); ++cIt; } filenames.push_back( FileNamesPerVolume ); } // TODO : only prototyping to test loading of diffusion images // we need some solution for the different types typedef mitk::DiffusionImage DiffusionImageType; DiffusionImageType::Pointer output_image = DiffusionImageType::New(); DiffusionImageType::GradientDirectionContainerType::Pointer directions = DiffusionImageType::GradientDirectionContainerType::New(); double max_bvalue = 0; for( size_t idx = 0; idx < number_of_outputs; idx++ ) { DiffusionImageDICOMHeaderInformation header = this->m_RetrievedHeader.at(idx); if( max_bvalue < header.b_value ) max_bvalue = header.b_value; } // normalize the retrieved gradient directions according to the set b-value (maximal one) for( size_t idx = 0; idx < number_of_outputs; idx++ ) { DiffusionImageDICOMHeaderInformation header = this->m_RetrievedHeader.at(idx); DiffusionImageType::GradientDirectionType grad = header.g_vector; grad.normalize(); grad *= sqrt( header.b_value / max_bvalue ); directions->push_back( grad ); } bool is_mosaic_file = false; // FIXME : criterion for testing MOSAIC /* { is_mosaic_file = true; }*/ // initialize the output image output_image->SetDirections( directions ); output_image->SetB_Value( max_bvalue ); if( is_mosaic_file ) { mitk::MosaicDescriptor mdesc; // FIXME : will come from the header information mdesc.nimages = 50; output_image->SetVectorImage( helper.LoadMosaicToVector( filenames, mdesc ) ); } else { output_image->SetVectorImage( helper.LoadToVector( filenames ) ); } output_image->InitializeFromVectorImage(); output_image->UpdateBValueMap(); // reduce the number of outputs to 1 as we will produce a single image this->SetNumberOfOutputs(1); // set the image to output DICOMImageBlockDescriptor& block = this->InternalGetOutput(0); block.SetMitkImage( (mitk::Image::Pointer) output_image ); + return block.GetMitkImage().IsNotNull(); + } void mitk::DiffusionDICOMFileReader ::AnalyzeInputFiles() { Superclass::AnalyzeInputFiles(); // collect output from superclass size_t number_of_outputs = this->GetNumberOfOutputs(); if(number_of_outputs == 0) { MITK_ERROR << "Failed to parse input, retrieved 0 outputs from SeriesGDCMReader "; } DICOMImageBlockDescriptor block_0 = this->GetOutput(0); MITK_INFO << "Retrieved " << number_of_outputs << "outputs."; // collect vendor ID from the first output, first image StringList inputFilename; DICOMImageFrameInfo::Pointer frame_0 = block_0.GetImageFrameList().at(0); inputFilename.push_back( frame_0->Filename ); gdcm::Scanner gdcmScanner; gdcm::Tag t_vendor(0x008, 0x0070); gdcm::Tag t_imagetype(0x008, 0x008); // add DICOM Tag for vendor gdcmScanner.AddTag( t_vendor ); // add DICOM Tag for image type gdcmScanner.AddTag( t_imagetype ); gdcmScanner.Scan( inputFilename ); // retrieve both vendor and image type std::string vendor = gdcmScanner.GetValue( frame_0->Filename.c_str(), t_vendor ); std::string image_type = gdcmScanner.GetValue( frame_0->Filename.c_str(), t_imagetype ); MITK_INFO << "Got vendor: " << vendor << " image type " << image_type; mitk::DiffusionHeaderDICOMFileReader::Pointer header_reader; // parse vendor tag if( vendor.find("SIEMENS") != std::string::npos ) { if( image_type.find("MOSAIC") != std::string::npos ) { header_reader = mitk::DiffusionHeaderSiemensMosaicDICOMFileReader::New(); } else { header_reader = mitk::DiffusionHeaderSiemensDICOMFileReader::New(); } } else if( vendor.find("GE") != std::string::npos ) { header_reader = mitk::DiffusionHeaderGEDICOMFileReader::New(); } else if( vendor.find("PHILIPS") != std::string::npos ) { } else { // unknown vendor } if( header_reader.IsNull() ) { MITK_ERROR << "No header reader for given vendor. "; return; } bool canread = false; - for( size_t idx; idx < number_of_outputs; idx++ ) + for( size_t idx = 0; idx < number_of_outputs; idx++ ) { DICOMImageFrameInfo::Pointer frame = this->GetOutput( idx ).GetImageFrameList().at(0); canread = header_reader->ReadDiffusionHeader(frame->Filename); } // collect the information m_RetrievedHeader = header_reader->GetHeaderInformation(); // TODO : Analyze outputs + header information, i.e. for the loading confidence MITK_INFO << "----- Diffusion DICOM Analysis Report ---- "; PerformHeaderAnalysis( m_RetrievedHeader ); MITK_INFO << "==========================================="; } bool mitk::DiffusionDICOMFileReader ::CanHandleFile(const std::string &filename) { - + //FIXME : + return true; } diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.cpp index 5b0ec021ae..01173058c6 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.cpp +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.cpp @@ -1,41 +1,60 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkDiffusionHeaderDICOMFileReader.h" mitk::DiffusionHeaderDICOMFileReader ::DiffusionHeaderDICOMFileReader() { } mitk::DiffusionHeaderDICOMFileReader ::~DiffusionHeaderDICOMFileReader() { } mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType mitk::DiffusionHeaderDICOMFileReader ::GetHeaderInformation() { if( m_HeaderInformationList.size() < 1 ) { MITK_WARN << "No information retrieved yet. Call AnalyzeInputFiles first!"; } return m_HeaderInformationList; } + +bool mitk::RevealBinaryTag(const gdcm::Tag tag, const gdcm::DataSet& dataset, std::string& target) +{ + if( dataset.FindDataElement( tag ) ) + { + MITK_DEBUG << "Found tag " << tag.PrintAsPipeSeparatedString(); + + const gdcm::DataElement& de = dataset.GetDataElement( tag ); + target = std::string( de.GetByteValue()->GetPointer(), + de.GetByteValue()->GetLength() ); + return true; + + } + else + { + MITK_DEBUG << "Could not find tag " << tag.PrintAsPipeSeparatedString(); + return false; + } +} diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h index b890d15e94..845962405c 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h @@ -1,132 +1,115 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKDIFFUSIONHEADERFILEREADER_H #define MITKDIFFUSIONHEADERFILEREADER_H #include #include #include "mitkDiffusionImage.h" #include "gdcmScanner.h" #include "gdcmReader.h" namespace mitk { /** * @brief The DiffusionImageHeaderInformation struct */ struct DiffusionImageDICOMHeaderInformation { DiffusionImageDICOMHeaderInformation() : b_value(0), baseline(false), isotropic(false) { g_vector.fill(0); } void Print() { MITK_INFO << " DiffusionImageHeaderInformation : \n" << " : b value : " << b_value << "\n" << " : gradient : " << g_vector << "\n" << " : isotropic : " << isotropic << "\n --- \n"; } unsigned int b_value; vnl_vector_fixed< double, 3> g_vector; bool baseline; bool isotropic; }; struct DiffusionImageMosaicDICOMHeaderInformation : public DiffusionImageDICOMHeaderInformation { unsigned long n_images; bool slicenormalup; }; /** * @class DiffusionHeaderDICOMFileReader * * @brief Abstract class for all vendor specific diffusion file header reader * * To provide a diffusion header reader for a new vendor, reimplement the \sa ReadDiffusionHeader method. */ class DiffusionCore_EXPORT DiffusionHeaderDICOMFileReader : public itk::LightObject { public: typedef std::vector< DiffusionImageDICOMHeaderInformation > DICOMHeaderListType; mitkClassMacro( DiffusionHeaderDICOMFileReader, itk::LightObject ) itkSimpleNewMacro( Self ) /** * @brief IsDiffusionHeader Parse the given dicom file and collect the special diffusion image information * @return */ virtual bool ReadDiffusionHeader( std::string ){ return false; } DICOMHeaderListType GetHeaderInformation(); protected: DiffusionHeaderDICOMFileReader(); virtual ~DiffusionHeaderDICOMFileReader(); DICOMHeaderListType m_HeaderInformationList; }; /** * @brief Retrieve the value of a gdcm tag to the given string * * @param tag the gdcm::Tag to be search for * @param dataset a gdcm::DataSet to look into * @param target a string to store the value of the given tag if found * @param verbose make some output * * @return true if a string was found, false otherwise */ -static bool RevealBinaryTag(const gdcm::Tag tag, const gdcm::DataSet& dataset, std::string& target, bool verbose = true) -{ - if( dataset.FindDataElement( tag ) ) - { - if(verbose) MITK_INFO << "Found tag " << tag.PrintAsPipeSeparatedString(); - - const gdcm::DataElement& de = dataset.GetDataElement( tag ); - target = std::string( de.GetByteValue()->GetPointer(), - de.GetByteValue()->GetLength() ); - return true; - - } - else - { - if(verbose) MITK_INFO << "Could not find tag " << tag.PrintAsPipeSeparatedString(); - return false; - } -} +bool RevealBinaryTag(const gdcm::Tag tag, const gdcm::DataSet& dataset, std::string& target); } // end namespace mitk #endif // MITKDIFFUSIONHEADERFILEREADER_H diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.cpp new file mode 100644 index 0000000000..043f5e94f2 --- /dev/null +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.cpp @@ -0,0 +1,42 @@ +#include "mitkDiffusionHeaderSiemensDICOMFileHelper.h" + +#include +#include + +mitk::SiemensDiffusionHeaderType mitk::GetHeaderType( std::string header ) +{ + // The CSA2 format begins with the string ‘SV10’, the CSA1 format does not. + if( header.find("SV10") != std::string::npos ) + { + return mitk::SIEMENS_CSA2; + } + else + { + return mitk::SIEMENS_CSA1; + } +} + +bool mitk::ParseInputString( std::string input, std::vector& values, Siemens_Header_Format format_specs ) +{ + + // TODO : Compute offset based on the format_specs, where does the 84 come from??? + int offset = 84; + int vm = *(input.c_str() + format_specs.NameLength ); + + for (int k = 0; k < vm; k++) + { + int itemLength = *(input.c_str() + offset + 4); + + int strideSize = static_cast (ceil(static_cast(itemLength)/4) * 4); + std::string valueString = input.substr( offset+16, itemLength ); + + double value = atof( valueString.c_str() ); + values.push_back( value ); + + offset += 16+strideSize; + } + + return true; +} + + diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.h index ce6039571f..26abbfab51 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.h +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.h @@ -1,72 +1,45 @@ #ifndef MITKDIFFUSIONHEADERSIEMENSDICOMFILEHELPER_H #define MITKDIFFUSIONHEADERSIEMENSDICOMFILEHELPER_H +#include +#include + +namespace mitk +{ enum SiemensDiffusionHeaderType { SIEMENS_CSA1 = 0, SIEMENS_CSA2 }; -static SiemensDiffusionHeaderType GetHeaderType( std::string header ) -{ - // The CSA2 format begins with the string ‘SV10’, the CSA1 format does not. - if( header.find("SV10") != std::string::npos ) - { - return SIEMENS_CSA2; - } - else - { - return SIEMENS_CSA1; - } -} +SiemensDiffusionHeaderType GetHeaderType( std::string header ); struct Siemens_Header_Format { Siemens_Header_Format( size_t nlen, size_t vm, size_t vr, size_t syngodt, size_t nitems ) : NameLength( nlen ), Delimiter( "\0" ), VM( vm ), VR( vr ), Syngodt( syngodt ), NumItems( nitems ) { } size_t NameLength; std::string Delimiter; size_t VM; size_t VR; size_t Syngodt; size_t NumItems; }; -static bool ParseInputString( std::string input, std::vector& values, Siemens_Header_Format format_specs ) -{ - - // TODO : Compute offset based on the format_specs, where does the 84 come from??? - int offset = 84; - int vm = *(input.c_str() + format_specs.NameLength ); - - for (int k = 0; k < vm; k++) - { - int itemLength = *(input.c_str() + offset + 4); - - int strideSize = static_cast (ceil(static_cast(itemLength)/4) * 4); - std::string valueString = input.substr( offset+16, itemLength ); - - double value = atof( valueString.c_str() ); - values.push_back( value ); - - offset += 16+strideSize; - } - - return true; -} - +bool ParseInputString( std::string input, std::vector& values, Siemens_Header_Format format_specs ); +} //end namespace #endif // MITKDIFFUSIONHEADERSIEMENSDICOMFILEHELPER_H diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.cpp index 6ff039be65..70a72329c6 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.cpp +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.cpp @@ -1,143 +1,146 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkDiffusionHeaderSiemensDICOMFileReader.h" +#include "mitkDiffusionHeaderSiemensDICOMFileHelper.h" #include "gdcmScanner.h" #include "gdcmReader.h" /** * @brief Extract b value from the siemens diffusion tag */ bool mitk::DiffusionHeaderSiemensDICOMFileReader ::ExtractSiemensDiffusionTagInformation( std::string tag_value, mitk::DiffusionImageDICOMHeaderInformation& values) { - SiemensDiffusionHeaderType hformat = GetHeaderType( tag_value ); + SiemensDiffusionHeaderType hformat = mitk::GetHeaderType( tag_value ); Siemens_Header_Format specs = this->m_SiemensFormatsCollection.at( hformat ); MITK_DEBUG << " Header format: " << hformat; MITK_DEBUG << " :: Retrieving b value. "; std::string::size_type tag_position = tag_value.find( "B_value", 0 ); if( tag_position == std::string::npos ) { MITK_ERROR << "No b value information found. "; return false; } std::string value_string = tag_value.substr( tag_position, tag_value.size() - tag_position + 1 ); std::vector value_array; if( ParseInputString(value_string, value_array, specs) ) { values.b_value = value_array.at(0); } // search for GradientDirectionInformation if the bvalue is not null if( values.b_value > 0 ) { std::string::size_type tag_position = tag_value.find( "DiffusionGradientDirection", 0 ); // Possibly it is a IVIM dataset, i.e. the gradient direction is not relevant // and possibly either not set or set to zero if( tag_position == std::string::npos ) { MITK_WARN << "No gradient direction information, but non-zero b-value. Possibly an IVIM dataset. " << "\n" << "Setting gradient to (1,1,1)."; values.isotropic = true; values.g_vector.fill(1); return false; } value_array.clear(); std::string gradient_direction_str = tag_value.substr( tag_position, tag_value.size() - tag_position + 1 ); if( ParseInputString(gradient_direction_str, value_array, specs) ) { if( value_array.size() != 3 ) { MITK_ERROR << " Retrieved gradient information of length " << value_array.size(); return false; } for( unsigned int i=0; iExtractSiemensDiffusionTagInformation( siemens_diffusionheader_str, values ); m_HeaderInformationList.push_back( values ); } + return true; + } diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.cpp index bf775da920..f9c6a16049 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.cpp +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.cpp @@ -1,79 +1,81 @@ +#include "mitkDiffusionHeaderSiemensDICOMFileHelper.h" #include "mitkDiffusionHeaderSiemensMosaicDICOMFileReader.h" mitk::DiffusionHeaderSiemensMosaicDICOMFileReader::DiffusionHeaderSiemensMosaicDICOMFileReader() : DiffusionHeaderSiemensDICOMFileReader() { } mitk::DiffusionHeaderSiemensMosaicDICOMFileReader ::~DiffusionHeaderSiemensMosaicDICOMFileReader() { } bool mitk::DiffusionHeaderSiemensMosaicDICOMFileReader ::ReadDiffusionHeader(std::string filename) { gdcm::Reader gdcmReader; gdcmReader.SetFileName( filename.c_str() ); gdcmReader.Read(); MITK_INFO << " -- Analyzing: " << filename; const gdcm::DataSet& dataset = gdcmReader.GetFile().GetDataSet(); const gdcm::Tag t_sie_diffusion( 0x0029,0x1010 ); std::string siemens_diffusionheader_str; if( RevealBinaryTag( t_sie_diffusion, dataset, siemens_diffusionheader_str ) ) { mitk::DiffusionImageMosaicDICOMHeaderInformation header_values; this->ExtractSiemensDiffusionTagInformation( siemens_diffusionheader_str, header_values ); //MITK_INFO << siemens_diffusionheader_str; - SiemensDiffusionHeaderType hformat = GetHeaderType( siemens_diffusionheader_str ); + mitk::SiemensDiffusionHeaderType hformat = GetHeaderType( siemens_diffusionheader_str ); Siemens_Header_Format specs = this->m_SiemensFormatsCollection.at( hformat ); - double n_images = 0; std::string::size_type tag_position = siemens_diffusionheader_str.find( "NumberOfImagesInMosaic", 0 ); if( tag_position != std::string::npos ) { std::vector value_array; ParseInputString( siemens_diffusionheader_str.substr( tag_position, siemens_diffusionheader_str.size() - tag_position + 1 ), value_array, specs ); header_values.n_images = value_array[0]; } tag_position = siemens_diffusionheader_str.find("SliceNormalVector", 0); if( tag_position != std::string::npos ) { std::vector value_array; ParseInputString( siemens_diffusionheader_str.substr( tag_position, siemens_diffusionheader_str.size() - tag_position + 1 ), value_array, specs ); MITK_DEBUG << "SliceNormal"; for( unsigned int i=0; i 2 ) { header_values.slicenormalup = (value_array[2] > 0); } } m_HeaderInformationList.push_back( header_values ); } + return (m_HeaderInformationList.size() > 0); + } diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/test.txt b/Modules/DiffusionImaging/DiffusionCore/DicomImport/test.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Modules/DiffusionImaging/DiffusionCore/files.cmake b/Modules/DiffusionImaging/DiffusionCore/files.cmake index dc82108281..c37b6190d5 100644 --- a/Modules/DiffusionImaging/DiffusionCore/files.cmake +++ b/Modules/DiffusionImaging/DiffusionCore/files.cmake @@ -1,114 +1,134 @@ 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 DicomImport/mitkDiffusionDICOMFileReader.cpp DicomImport/mitkDiffusionHeaderDICOMFileReader.cpp DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.cpp + DicomImport/mitkDiffusionHeaderSiemensDICOMFileHelper.cpp DicomImport/mitkDiffusionHeaderSiemensMosaicDICOMFileReader.cpp DicomImport/mitkDiffusionHeaderGEDICOMFileReader.cpp + + # DataStructures -> DWI + IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.cpp + IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSource.cpp + IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.cpp + + IODataStructures/DiffusionWeightedImages/mitkImageToDiffusionImageSource.cpp + IODataStructures/DiffusionWeightedImages/mitkDiffusionImageCorrectionFilter.cpp + + # DataStructures -> QBall + IODataStructures/QBallImages/mitkQBallImageSource.cpp + IODataStructures/QBallImages/mitkQBallImage.cpp + + # DataStructures -> Tensor + IODataStructures/TensorImages/mitkTensorImage.cpp + Rendering/vtkMaskedProgrammableGlyphFilter.cpp Rendering/mitkVectorImageVtkGlyphMapper3D.cpp Rendering/vtkOdfSource.cxx Rendering/vtkThickPlane.cxx Rendering/mitkOdfNormalizationMethodProperty.cpp Rendering/mitkOdfScaleByProperty.cpp # Algorithms Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.cpp Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.cpp Algorithms/itkDwiGradientLengthCorrectionFilter.cpp # Registration Algorithms & Co. Algorithms/Registration/mitkRegistrationWrapper.cpp Algorithms/Registration/mitkPyramidImageRegistrationMethod.cpp # MultishellProcessing Algorithms/Reconstruction/MultishellProcessing/itkADCAverageFunctor.cpp Algorithms/Reconstruction/MultishellProcessing/itkADCFitFunctor.cpp Algorithms/Reconstruction/MultishellProcessing/itkKurtosisFitFunctor.cpp Algorithms/Reconstruction/MultishellProcessing/itkBiExpFitFunctor.cpp # Function Collection mitkDiffusionFunctionCollection.cpp ) set(H_FILES # function Collection mitkDiffusionFunctionCollection.h # Rendering Rendering/mitkDiffusionImageMapper.h Rendering/mitkOdfVtkMapper2D.h # Reconstruction Algorithms/Reconstruction/itkDiffusionQballReconstructionImageFilter.h Algorithms/Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h Algorithms/Reconstruction/itkAnalyticalDiffusionQballReconstructionImageFilter.h Algorithms/Reconstruction/itkDiffusionMultiShellQballReconstructionImageFilter.h Algorithms/Reconstruction/itkPointShell.h Algorithms/Reconstruction/itkOrientationDistributionFunction.h Algorithms/Reconstruction/itkDiffusionIntravoxelIncoherentMotionReconstructionImageFilter.h # MultishellProcessing Algorithms/Reconstruction/MultishellProcessing/itkRadialMultishellToSingleshellImageFilter.h Algorithms/Reconstruction/MultishellProcessing/itkDWIVoxelFunctor.h Algorithms/Reconstruction/MultishellProcessing/itkADCAverageFunctor.h Algorithms/Reconstruction/MultishellProcessing/itkKurtosisFitFunctor.h Algorithms/Reconstruction/MultishellProcessing/itkBiExpFitFunctor.h Algorithms/Reconstruction/MultishellProcessing/itkADCFitFunctor.h + # IO Datastructures + IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.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/itkGaussianInterpolateImageFunction.h Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h Algorithms/mitkPartialVolumeAnalysisClusteringCalculator.h Algorithms/itkDiffusionTensorPrincipalDirectionImageFilter.h Algorithms/itkCartesianToPolarVectorImageFilter.h Algorithms/itkPolarToCartesianVectorImageFilter.h Algorithms/itkDistanceMapFilter.h Algorithms/itkProjectionFilter.h Algorithms/itkResidualImageFilter.h Algorithms/itkExtractChannelFromRgbaImageFilter.h Algorithms/itkTensorReconstructionWithEigenvalueCorrectionFilter.h Algorithms/itkMergeDiffusionImagesFilter.h Algorithms/itkDwiPhantomGenerationFilter.h Algorithms/itkFiniteDiffOdfMaximaExtractionFilter.h Algorithms/itkMrtrixPeakImageConverter.h Algorithms/itkFslPeakImageConverter.h Algorithms/itkShCoefficientImageImporter.h Algorithms/itkShCoefficientImageExporter.h Algorithms/itkOdfMaximaExtractionFilter.h Algorithms/itkResampleDwiImageFilter.h Algorithms/itkDwiGradientLengthCorrectionFilter.h Algorithms/itkAdcImageFilter.h Algorithms/itkSplitDWImageFilter.h Algorithms/Registration/mitkDWIHeadMotionCorrectionFilter.h Algorithms/mitkDiffusionImageToDiffusionImageFilter.h Algorithms/itkNonLocalMeansDenoisingFilter.h Algorithms/itkVectorImageToImageFilter.h ) set( TOOL_FILES )