17 #ifndef mitkDicomSeriesReader_h
18 #define mitkDicomSeriesReader_h
23 #include <itkGDCMImageIO.h>
25 #include <itkCommand.h>
26 #include <itkImageSeriesReader.h>
33 #include <gdcmConfigure.h>
42 #include <gdcmDataSet.h>
43 #include <gdcmScanner.h>
361 typedef void (*UpdateCallBackMethod)(float);
376 ReaderImplementationLevel_Implemented,
389 PixelSpacingInterpretation_SpacingUnknown
403 StringContainer GetFilenames()
const;
406 std::string GetImageBlockUID()
const;
409 std::string GetSeriesInstanceUID()
const;
412 std::string GetModality()
const;
415 std::string GetSOPClassUIDAsString()
const;
418 std::string GetSOPClassUID()
const;
424 bool HasGantryTiltCorrected()
const;
427 bool PixelSpacingRelatesToPatient()
const;
429 bool PixelSpacingRelatesToDetector()
const;
431 bool PixelSpacingIsUnknown()
const;
437 bool HasMultipleTimePoints()
const;
440 bool IsMultiFrameImage()
const;
450 void AddFile(
const std::string &file);
451 void AddFiles(
const StringContainer &files);
453 void SetImageBlockUID(
const std::string &uid);
455 void SetSeriesInstanceUID(
const std::string &uid);
457 void SetModality(
const std::string &modality);
459 void SetNumberOfFrames(
const std::string &);
461 void SetSOPClassUID(
const std::string &mediaStorageSOPClassUID);
463 void SetHasGantryTiltCorrected(
bool);
465 void SetPixelSpacingInformation(
const std::string &pixelSpacing,
const std::string &imagerPixelSpacing);
467 void SetHasMultipleTimePoints(
bool);
471 StringContainer m_Filenames;
472 std::string m_ImageBlockUID;
473 std::string m_SeriesInstanceUID;
474 std::string m_Modality;
475 std::string m_SOPClassUID;
476 bool m_HasGantryTiltCorrected;
477 std::string m_PixelSpacing;
478 std::string m_ImagerPixelSpacing;
479 bool m_HasMultipleTimePoints;
480 bool m_IsMultiFrameImage;
491 static std::string GetConfigurationString();
496 static bool IsDicom(
const std::string &
filename);
503 static FileNamesGrouping GetSeries(
const std::string &dir,
504 bool groupImagesWithGantryTilt,
505 const StringContainer &restrictions = StringContainer());
515 static StringContainer GetSeries(
const std::string &dir,
516 const std::string &series_uid,
517 bool groupImagesWithGantryTilt,
518 const StringContainer &restrictions = StringContainer());
544 static FileNamesGrouping GetSeries(
const StringContainer &files,
546 bool groupImagesWithGantryTilt,
547 const StringContainer &restrictions = StringContainer());
554 static FileNamesGrouping GetSeries(
const StringContainer &files,
555 bool groupImagesWithGantryTilt,
556 const StringContainer &restrictions = StringContainer());
569 bool correctGantryTilt =
true,
570 UpdateCallBackMethod callback =
nullptr,
579 static bool LoadDicomSeries(
const StringContainer &filenames,
583 bool correctGantryTilt =
true,
584 UpdateCallBackMethod callback =
nullptr,
607 StringContainer GetBlockFilenames();
612 StringContainer GetUnsortedFilenames();
617 bool ContainsGantryTilt();
622 void AddFileToSortedBlock(
const std::string &
filename);
627 void AddFileToUnsortedBlock(
const std::string &filename);
628 void AddFilesToUnsortedBlock(
const StringContainer &filenames);
634 void FlagGantryTilt();
639 void UndoPrematureGrouping();
691 unsigned int numberOfSlicesApart);
698 bool IsSheared()
const;
709 bool IsRegularGantryTilt()
const;
714 double GetMatrixCoefficientForCorrectionInWorldCoordinates()
const;
719 double GetRealZSpacing()
const;
726 double GetTiltCorrectedAdditionalSize()
const;
731 double GetTiltAngleInDegrees()
const;
737 Point3D projectPointOnLine(Point3Dd p, Point3Dd lineOrigin, Vector3Dd lineDirection);
772 const StringContainer &files,
bool groupsOfSimilarImages,
const gdcm::Scanner::MappingType &tagValueMappings_);
777 static std::string ConstCharStarToString(
const char *s);
804 template <
typename ImageType>
828 static StringContainer SortSeriesSlices(
const StringContainer &unsortedFilenames);
834 static bool IsPhilips3DDicom(
const std::string &
filename);
848 static std::string CreateMoreUniqueSeriesIdentifier(gdcm::Scanner::TagToValue &tagValueMap);
853 static std::string CreateSeriesIdentifierPart(gdcm::Scanner::TagToValue &tagValueMap,
const gdcm::Tag &tag);
858 static std::string IDifyTagValue(
const std::string &value);
869 void Execute(
const itk::Object *caller,
const itk::EventObject &)
override
871 (*this->m_Callback)(static_cast<const itk::ProcessObject *>(caller)->GetProgress());
874 void Execute(itk::Object *caller,
const itk::EventObject &)
override
876 (*this->m_Callback)(static_cast<itk::ProcessObject *>(caller)->GetProgress());
888 static void ScanForSliceInformation(
const StringContainer &filenames, gdcm::Scanner &scanner);
893 static void LoadDicom(
const StringContainer &filenames,
898 UpdateCallBackMethod callback,
906 template <
typename PixelType>
935 template <
typename PixelType>
982 static std::list<StringContainer> SortIntoBlocksFor3DplusT(
const StringContainer &presortedFilenames,
983 const gdcm::Scanner::MappingType &tagValueMappings_,
993 static bool GdcmSortFunction(
const gdcm::DataSet &ds1,
const gdcm::DataSet &ds2);
1000 static void CopyMetaDataToImageProperties(StringContainer filenames,
1001 const gdcm::Scanner::MappingType &tagValueMappings_,
1005 static void CopyMetaDataToImageProperties(std::list<StringContainer> imageBlock,
1006 const gdcm::Scanner::MappingType &tagValueMappings_,
1019 static const TagToPropertyMapType &GetDICOMTagsToMITKPropertyMap();
PixelSpacingInterpretation
How the mitk::Image spacing should be interpreted.
distances are mm within a patient
std::map< std::string, std::string > TagToPropertyMapType
Maps DICOM tags to MITK properties.
itk::SmartPointer< Self > Pointer
Return type of GetSeries, describes a logical group of files.
bool DICOMStringToSpacing(const std::string &s, ScalarType &spacingX, ScalarType &spacingY)
void Execute(const itk::Object *caller, const itk::EventObject &) override
std::pair< StringContainer, StringContainer > TwoStringContainers
for internal sorting.
void DICOMStringToOrientationVectors(const std::string &s, Vector3D &right, Vector3D &up, bool &successful)
Convert DICOM string describing a point two Vector3D.
std::vector< std::string > StringContainer
Lists of filenames.
DataCollection - Class to facilitate loading/accessing structured data.
std::string ReaderImplementationLevelToString(const ReaderImplementationLevel &enumValue)
Convert mitk::ReaderImplementationLevel to a human readable string.
UpdateCallBackMethod m_Callback
loader code is implemented but not accompanied by tests
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type (see mitk::DICOMFileReader).
PixelSpacingInterpretation
How the mitk::Image spacing should be interpreted (see mitk::DICOMFileReader).
map::core::discrete::Elements< 3 >::InternalImageType ImageType
StringContainer m_UnsortedFiles
static const std::string filename
void Execute(itk::Object *caller, const itk::EventObject &) override
std::string PixelSpacingInterpretationToString(const PixelSpacingInterpretation &value)
Convert mitk::PixelSpacingInterpretation to a human readable string.
Image class for storing images.
Progress callback for DicomSeriesReader.
StringContainer m_GroupedFiles
loader code and tests are established
Return type of DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption.
CallbackCommand(UpdateCallBackMethod callback)
Point3D DICOMStringToPoint3D(const std::string &s, bool &successful)
Convert DICOM string describing a point to Point3D.
std::map< std::string, ImageBlockDescriptor > FileNamesGrouping
itk::GDCMImageIO DcmIoType
ReaderImplementationLevel
Describes how well the reader is tested for a certain file type.
Class for nodes of the DataTree.