diff --git a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt index ee6603a659..2a78690911 100644 --- a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt +++ b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt @@ -1,17 +1,17 @@ find_package(ITK) if(ITK_GDCM_DIR) include(${ITK_GDCM_DIR}/GDCMConfig.cmake) if(GDCM_MAJOR_VERSION EQUAL 2) add_definitions(-DGDCM2) set(ITK_USES_GDCM2 1) endif(GDCM_MAJOR_VERSION EQUAL 2) endif(ITK_GDCM_DIR) 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 MitkExt SceneSerializationBase # QmitkExt + DEPENDS MitkExt SceneSerializationBase DICOMReader # QmitkExt PACKAGE_DEPENDS Boost ) add_subdirectory(Testing) diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp new file mode 100644 index 0000000000..3e27d29fa4 --- /dev/null +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp @@ -0,0 +1,133 @@ +/*=================================================================== + +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 "mitkDiffusionHeaderDICOMFileReader.h" +#include "mitkDiffusionHeaderSiemensDICOMFileReader.h" + +mitk::DiffusionDICOMFileReader::DiffusionDICOMFileReader() +{ + +} + +mitk::DiffusionDICOMFileReader::~DiffusionDICOMFileReader() +{ + +} + +bool mitk::DiffusionDICOMFileReader +::LoadImages() +{ + +} + +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 = 0; + } + else + { + header_reader = mitk::DiffusionHeaderSiemensDICOMFileReader::New(); + } + + } + else if( vendor.find("GE") != std::string::npos ) + { + + } + 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++ ) + { + DICOMImageFrameInfo::Pointer frame = this->GetOutput( idx ).GetImageFrameList().at(0); + canread = header_reader->ReadDiffusionHeader(frame->Filename); + + MITK_INFO << "Can read ()" << idx << " value: " << canread; + + canread = false; + } + + + + +} + + +bool mitk::DiffusionDICOMFileReader +::CanHandleFile(const std::string &filename) +{ + +} + diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h new file mode 100644 index 0000000000..2435079868 --- /dev/null +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h @@ -0,0 +1,50 @@ +/*=================================================================== + +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 MITKDIFFUSIONDICOMFILEREADER_H +#define MITKDIFFUSIONDICOMFILEREADER_H + +#include "DiffusionCoreExports.h" + +#include "mitkDICOMITKSeriesGDCMReader.h" + +namespace mitk +{ + +class DiffusionCore_EXPORT DiffusionDICOMFileReader + : public DICOMITKSeriesGDCMReader +{ +public: + + mitkClassMacro( DiffusionDICOMFileReader, DICOMITKSeriesGDCMReader ) + mitkCloneMacro( DiffusionDICOMFileReader ) + + itkNewMacro( DiffusionDICOMFileReader ) + + virtual void AnalyzeInputFiles(); + + virtual bool LoadImages(); + + virtual bool CanHandleFile(const std::string &filename); + +protected: + DiffusionDICOMFileReader(); + virtual ~DiffusionDICOMFileReader(); +}; + +} + +#endif // MITKDIFFUSIONDICOMFILEREADER_H