diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp index 2b9cb7b927..46daf28f1c 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.cpp @@ -1,248 +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 ); + output_image->SetReferenceBValue( 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(); + //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 = 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/mitkDiffusionDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h index 5ed962aa3c..61889e840d 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionDICOMFileReader.h @@ -1,53 +1,53 @@ /*=================================================================== 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 "MitkDiffusionCoreExports.h" #include "mitkDICOMITKSeriesGDCMReader.h" #include "mitkDiffusionHeaderDICOMFileReader.h" namespace mitk { -class DiffusionCore_EXPORT DiffusionDICOMFileReader +class MitkDiffusionCore_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(); mitk::DiffusionHeaderDICOMFileReader::DICOMHeaderListType m_RetrievedHeader; }; } #endif // MITKDIFFUSIONDICOMFILEREADER_H diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h index 845962405c..e558376d35 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderDICOMFileReader.h @@ -1,115 +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 #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 +class MitkDiffusionCore_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 */ 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/mitkDiffusionHeaderGEDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h index 0e0e23eac9..2f809d5e53 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderGEDICOMFileReader.h @@ -1,28 +1,28 @@ #ifndef MITKDIFFUSIONHEADERGEDICOMFILEREADER_H #define MITKDIFFUSIONHEADERGEDICOMFILEREADER_H -#include "DiffusionCoreExports.h" +#include "MitkDiffusionCoreExports.h" #include "mitkDiffusionHeaderDICOMFileReader.h" namespace mitk { -class DiffusionCore_EXPORT DiffusionHeaderGEDICOMFileReader +class MitkDiffusionCore_EXPORT DiffusionHeaderGEDICOMFileReader : public DiffusionHeaderDICOMFileReader { public: mitkClassMacro( DiffusionHeaderGEDICOMFileReader, DiffusionHeaderDICOMFileReader ) itkNewMacro( Self ) virtual bool ReadDiffusionHeader(std::string filename); protected: DiffusionHeaderGEDICOMFileReader(); virtual ~DiffusionHeaderGEDICOMFileReader(); }; } #endif // MITKDIFFUSIONHEADERGEDICOMFILEREADER_H diff --git a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h index 53c7d5b456..2f9e94dde2 100644 --- a/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h +++ b/Modules/DiffusionImaging/DiffusionCore/DicomImport/mitkDiffusionHeaderSiemensDICOMFileReader.h @@ -1,49 +1,49 @@ /*=================================================================== 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 MITKDIFFUSIONHEADERSIEMENSDICOMFILEREADER_H #define MITKDIFFUSIONHEADERSIEMENSDICOMFILEREADER_H -#include "DiffusionCoreExports.h" +#include "MitkDiffusionCoreExports.h" #include "mitkDiffusionHeaderDICOMFileReader.h" #include "mitkDiffusionHeaderSiemensDICOMFileHelper.h" namespace mitk { -class DiffusionCore_EXPORT DiffusionHeaderSiemensDICOMFileReader +class MitkDiffusionCore_EXPORT DiffusionHeaderSiemensDICOMFileReader : public DiffusionHeaderDICOMFileReader { public: mitkClassMacro( DiffusionHeaderSiemensDICOMFileReader, DiffusionHeaderDICOMFileReader ) itkNewMacro( Self ) virtual bool ReadDiffusionHeader(std::string filename); protected: DiffusionHeaderSiemensDICOMFileReader(); ~DiffusionHeaderSiemensDICOMFileReader(); bool ExtractSiemensDiffusionTagInformation( std::string tag_value, mitk::DiffusionImageDICOMHeaderInformation& values ); std::vector< Siemens_Header_Format > m_SiemensFormatsCollection; }; } #endif // MITKDIFFUSIONHEADERSIEMENSDICOMFILEREADER_H diff --git a/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h b/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h index f2467bc717..d1e41e441e 100644 --- a/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h +++ b/Modules/DiffusionImaging/FiberTracking/Interactions/mitkFiberBundleInteractor.h @@ -1,99 +1,98 @@ /*=================================================================== 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 MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED #define MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED #include "mitkCommon.h" -#include "MitkExtExports.h" #include #include #include #include namespace mitk { class DataNode; //##Documentation //## @brief Just select a point, that's the only way to interact with the point //## //## Interact with a point: Select the point without moving to get parameters that does not change //## All Set-operations would be done through the method "ExecuteAction", if there would be anyone. //## the identificationnumber of this point is set by this points and evalued from an empty place in the DataStructure //## @ingroup Interaction class MitkFiberTracking_EXPORT FiberBundleInteractor : public Interactor { public: mitkClassMacro(FiberBundleInteractor, Interactor); mitkNewMacro2Param(Self, const char*, DataNode*); //##Documentation //## @brief Sets the amount of precision void SetPrecision(unsigned int precision); //##Documentation //## @brief derived from mitk::Interactor; calculates Jurisdiction according to points //## //## standard method can not be used, since it doesn't calculate in points, only in BoundingBox of Points virtual float CanHandleEvent(StateEvent const* stateEvent) const; protected: //##Documentation //##@brief Constructor FiberBundleInteractor(const char * type, DataNode* dataNode); //##Documentation //##@brief Destructor virtual ~FiberBundleInteractor(); //##Documentation //## @brief select the point on the given position virtual void SelectFiber(int position); //##Documentation //## @brief unselect all points that exist in mesh virtual void DeselectAllFibers(); //##Documentation //## @brief Executes Actions virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent); private: //##Documentation //## @brief to calculate a direction vector from last point and actual point Point3D m_LastPoint; //##Documentation //## @brief to store a position unsigned int m_LastPosition; // Point3D m_InitialPickedPoint; // Point2D m_InitialPickedDisplayPoint; // double m_InitialPickedPointWorld[4]; Point3D m_CurrentPickedPoint; Point2D m_CurrentPickedDisplayPoint; double m_CurrentPickedPointWorld[4]; }; } #endif /* MITKFiberBundleInteractor_H_HEADER_INCLUDED */