diff --git a/Modules/DICOMQI/CMakeLists.txt b/Modules/DICOMQI/CMakeLists.txt new file mode 100644 index 0000000000..01b9e69713 --- /dev/null +++ b/Modules/DICOMQI/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(autoload/IO) diff --git a/Modules/DICOMQI/autoload/IO/CMakeLists.txt b/Modules/DICOMQI/autoload/IO/CMakeLists.txt new file mode 100644 index 0000000000..7c70bf68ea --- /dev/null +++ b/Modules/DICOMQI/autoload/IO/CMakeLists.txt @@ -0,0 +1,9 @@ +MITK_CREATE_MODULE( DICOMQIIO + INCLUDE_DIRS + PRIVATE src/IO + DEPENDS PUBLIC MitkMultilabel + PACKAGE_DEPENDS + PRIVATE DCMQI DCMTK + AUTOLOAD_WITH MitkCore + WARNINGS_AS_ERRORS +) diff --git a/Modules/DICOMQI/autoload/IO/files.cmake b/Modules/DICOMQI/autoload/IO/files.cmake new file mode 100644 index 0000000000..53f91fb15f --- /dev/null +++ b/Modules/DICOMQI/autoload/IO/files.cmake @@ -0,0 +1,4 @@ +set(CPP_FILES + mitkDICOMSegmentationIO.cpp + mitkDICOMQIActivator.cpp +) diff --git a/Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp b/Modules/DICOMQI/autoload/IO/mitkDICOMQIActivator.cpp similarity index 79% copy from Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp copy to Modules/DICOMQI/autoload/IO/mitkDICOMQIActivator.cpp index 3f9491c746..b4bfbbeb95 100644 --- a/Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp +++ b/Modules/DICOMQI/autoload/IO/mitkDICOMQIActivator.cpp @@ -1,50 +1,48 @@ /*=================================================================== 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 #include #include #include #include "mitkDICOMSegmentationIO.h" -#include "mitkLabelSetImageIO.h" namespace mitk { /** - \brief Registers services for multilabel module. + \brief Registers services for multilabel dicom module. */ - class MultilabelModuleActivator : public us::ModuleActivator + class DICOMQIIOModulActivator : public us::ModuleActivator { std::vector m_FileIOs; public: void Load(us::ModuleContext * /*context*/) override { - m_FileIOs.push_back(new LabelSetImageIO()); m_FileIOs.push_back(new DICOMSegmentationIO()); } void Unload(us::ModuleContext *) override { for (auto &elem : m_FileIOs) { delete elem; } } }; } -US_EXPORT_MODULE_ACTIVATOR(mitk::MultilabelModuleActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::DICOMQIIOModulActivator) diff --git a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationIO.cpp b/Modules/DICOMQI/autoload/IO/mitkDICOMSegmentationIO.cpp similarity index 100% rename from Modules/Multilabel/autoload/IO/mitkDICOMSegmentationIO.cpp rename to Modules/DICOMQI/autoload/IO/mitkDICOMSegmentationIO.cpp diff --git a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationIO.h b/Modules/DICOMQI/autoload/IO/mitkDICOMSegmentationIO.h similarity index 93% rename from Modules/Multilabel/autoload/IO/mitkDICOMSegmentationIO.h rename to Modules/DICOMQI/autoload/IO/mitkDICOMSegmentationIO.h index b18bca559c..92d99e5bd2 100644 --- a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationIO.h +++ b/Modules/DICOMQI/autoload/IO/mitkDICOMSegmentationIO.h @@ -1,65 +1,65 @@ /*=================================================================== 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 __mitkDICOMSegmentationIO_h #define __mitkDICOMSegmentationIO_h #include #include -#include "MitkMultilabelIOExports.h" +#include "MitkDICOMQIIOExports.h" namespace mitk { /** * Read and Writes a LabelSetImage to a dcm file * @ingroup Process */ - class MITKMULTILABELIO_EXPORT DICOMSegmentationIO : public mitk::AbstractFileIO + class MITKDICOMQIIO_EXPORT DICOMSegmentationIO : public mitk::AbstractFileIO { public: typedef mitk::LabelSetImage InputType; typedef itk::Image itkInputImageType; typedef itk::Image itkInternalImageType; DICOMSegmentationIO(); // -------------- AbstractFileReader ------------- using AbstractFileReader::Read; /** * @brief Reads a number of DICOM segmentation from the file system * @return a vector of mitk::LabelSetImages * @throws throws an mitk::Exception if an error ocurrs */ virtual std::vector Read() override; virtual ConfidenceLevel GetReaderConfidenceLevel() const override; // -------------- AbstractFileWriter ------------- virtual void Write() override; virtual ConfidenceLevel GetWriterConfidenceLevel() const override; private: DICOMSegmentationIO *IOClone() const override; // -------------- DICOMSegmentationIO specific functions ------------- const std::string CreateMetaDataJsonFile(int layer); void AddDICOMTagsToService(); }; } // end of namespace mitk #endif // __mitkDICOMSegmentationIO_h diff --git a/Modules/ModuleList.cmake b/Modules/ModuleList.cmake index bf1084ad4a..9f184cf09e 100644 --- a/Modules/ModuleList.cmake +++ b/Modules/ModuleList.cmake @@ -1,84 +1,85 @@ # The entries in the mitk_modules list must be # ordered according to their dependencies. set(mitk_modules Core CommandLine AppUtil DCMTesting RDF LegacyIO DataTypesExt Annotation LegacyGL AlgorithmsExt MapperExt DICOMReader DICOMReaderServices DICOMTesting SceneSerializationBase PlanarFigure ImageDenoising ImageExtraction LegacyAdaptors SceneSerialization Gizmo GraphAlgorithms Multilabel ImageStatistics ContourModel SurfaceInterpolation Segmentation PlanarFigureSegmentation OpenViewCore QtWidgets QtWidgetsExt C3js QmlItems SegmentationUI Classification DiffusionImaging GPGPU OpenIGTLink IGTBase IGT CameraCalibration RigidRegistration RigidRegistrationUI DeformableRegistration DeformableRegistrationUI OpenCL OpenCVVideoSupport QtOverlays ToFHardware ToFProcessing ToFUI US USUI DicomUI Simulation Remeshing Python QtPython Persistence OpenIGTLinkUI IGTUI VtkShaders DicomRT RTUI IOExt XNAT TubeGraph BiophotonicsHardware TumorInvasionAnalysis MatchPointRegistration MatchPointRegistrationUI BoundingShape RenderWindowManager RenderWindowManagerUI CEST + DICOMQI ) if(MITK_ENABLE_PIC_READER) list(APPEND mitk_modules IpPicSupportIO) endif() diff --git a/Modules/Multilabel/CMakeLists.txt b/Modules/Multilabel/CMakeLists.txt index f2d6b55bf8..f26b41b665 100644 --- a/Modules/Multilabel/CMakeLists.txt +++ b/Modules/Multilabel/CMakeLists.txt @@ -1,10 +1,10 @@ MITK_CREATE_MODULE( - DEPENDS MitkCore MitkAlgorithmsExt MitkSceneSerializationBase + DEPENDS MitkCore MitkAlgorithmsExt MitkSceneSerializationBase MitkDICOMReader PACKAGE_DEPENDS PRIVATE ITK|ITKQuadEdgeMesh+ITKAntiAlias+ITKIONRRD WARNINGS_AS_ERRORS ) add_subdirectory(autoload/IO) if(BUILD_TESTING) add_subdirectory(Testing) endif() diff --git a/Modules/Multilabel/autoload/IO/CMakeLists.txt b/Modules/Multilabel/autoload/IO/CMakeLists.txt index fdd65535f7..012d169862 100644 --- a/Modules/Multilabel/autoload/IO/CMakeLists.txt +++ b/Modules/Multilabel/autoload/IO/CMakeLists.txt @@ -1,9 +1,9 @@ MITK_CREATE_MODULE( MultilabelIO INCLUDE_DIRS PRIVATE src/IO - DEPENDS PUBLIC MitkMultilabel MitkSceneSerialization MitkDICOMReader + DEPENDS PUBLIC MitkMultilabel MitkSceneSerialization PACKAGE_DEPENDS - PRIVATE DCMQI DCMTK ITK|ITKQuadEdgeMesh+ITKAntiAlias+ITKIONRRD + PRIVATE ITK|ITKQuadEdgeMesh+ITKAntiAlias+ITKIONRRD AUTOLOAD_WITH MitkCore WARNINGS_AS_ERRORS ) diff --git a/Modules/Multilabel/autoload/IO/files.cmake b/Modules/Multilabel/autoload/IO/files.cmake index 447da507ab..a5079ce423 100644 --- a/Modules/Multilabel/autoload/IO/files.cmake +++ b/Modules/Multilabel/autoload/IO/files.cmake @@ -1,13 +1,8 @@ set(CPP_FILES - mitkDICOMSegmentationIO.cpp - mitkDICOMSegmentationIO.h mitkLabelSetImageIO.cpp mitkLabelSetImageIO.h mitkLabelSetImageSerializer.cpp mitkLabelSetImageSerializer.h mitkMultilabelActivator.cpp - mitkDICOMSegmentationPropertyHelper.cpp - mitkDICOMSegmentationConstants.h - mitkDICOMSegmentationConstants.cpp ) diff --git a/Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp b/Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp index 3f9491c746..7e0249d052 100644 --- a/Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp +++ b/Modules/Multilabel/autoload/IO/mitkMultilabelActivator.cpp @@ -1,50 +1,48 @@ /*=================================================================== 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 #include #include #include -#include "mitkDICOMSegmentationIO.h" #include "mitkLabelSetImageIO.h" namespace mitk { /** \brief Registers services for multilabel module. */ - class MultilabelModuleActivator : public us::ModuleActivator + class MultilabelIOModuleActivator : public us::ModuleActivator { std::vector m_FileIOs; public: void Load(us::ModuleContext * /*context*/) override { m_FileIOs.push_back(new LabelSetImageIO()); - m_FileIOs.push_back(new DICOMSegmentationIO()); } void Unload(us::ModuleContext *) override { for (auto &elem : m_FileIOs) { delete elem; } } }; } -US_EXPORT_MODULE_ACTIVATOR(mitk::MultilabelModuleActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::MultilabelIOModuleActivator) diff --git a/Modules/Multilabel/files.cmake b/Modules/Multilabel/files.cmake index d068dd46b6..bde04e5e6f 100644 --- a/Modules/Multilabel/files.cmake +++ b/Modules/Multilabel/files.cmake @@ -1,17 +1,19 @@ set(CPP_FILES mitkLabel.cpp mitkLabelSet.cpp mitkLabelSetImage.cpp mitkLabelSetImageConverter.cpp mitkLabelSetImageSource.cpp mitkLabelSetImageSurfaceStampFilter.cpp mitkLabelSetImageToSurfaceFilter.cpp mitkLabelSetImageToSurfaceThreadedFilter.cpp mitkLabelSetImageVtkMapper2D.cpp mitkMultilabelObjectFactory.cpp mitkLabelSetIOHelper.cpp + mitkDICOMSegmentationPropertyHelper.cpp + mitkDICOMSegmentationConstants.cpp ) set(RESOURCE_FILES ) diff --git a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationConstants.cpp b/Modules/Multilabel/mitkDICOMSegmentationConstants.cpp similarity index 98% rename from Modules/Multilabel/autoload/IO/mitkDICOMSegmentationConstants.cpp rename to Modules/Multilabel/mitkDICOMSegmentationConstants.cpp index c01cc77796..d939903d01 100644 --- a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationConstants.cpp +++ b/Modules/Multilabel/mitkDICOMSegmentationConstants.cpp @@ -1,160 +1,159 @@ /*=================================================================== 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 "mitkIOConstants.h" -#include +#include "mitkDICOMSegmentationConstants.h" namespace mitk { DICOMTagPath DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH() { static DICOMTagPath path = DICOMTagPath().AddElement(0x0062, 0x0002); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_NUMBER_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH()).AddElement(0x0062, 0x0004); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_LABEL_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH()).AddElement(0x0062, 0x0005); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_ALGORITHM_TYPE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH()).AddElement(0x0062, 0x0008); return path; } DICOMTagPath DICOMSegmentationConstants::ANATOMIC_REGION_SEQUENCE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH()).AddElement(0x0008, 0x2218); return path; } DICOMTagPath DICOMSegmentationConstants::ANATOMIC_REGION_CODE_VALUE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::ANATOMIC_REGION_SEQUENCE_PATH()).AddElement(0x008, 0x0100); return path; } DICOMTagPath DICOMSegmentationConstants::ANATOMIC_REGION_CODE_SCHEME_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::ANATOMIC_REGION_SEQUENCE_PATH()).AddElement(0x008, 0x0102); return path; } DICOMTagPath DICOMSegmentationConstants::ANATOMIC_REGION_CODE_MEANING_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::ANATOMIC_REGION_SEQUENCE_PATH()).AddElement(0x008, 0x0104); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENTED_PROPERTY_CATEGORY_SEQUENCE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH()).AddElement(0x0062, 0x0003); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_CATEGORY_CODE_VALUE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_CATEGORY_SEQUENCE_PATH()).AddElement(0x008, 0x0100); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_CATEGORY_CODE_SCHEME_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_CATEGORY_SEQUENCE_PATH()).AddElement(0x008, 0x0102); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_CATEGORY_CODE_MEANING_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_CATEGORY_SEQUENCE_PATH()).AddElement(0x008, 0x0104); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENTED_PROPERTY_TYPE_SEQUENCE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENT_SEQUENCE_PATH()).AddElement(0x0062, 0x000F); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_TYPE_CODE_VALUE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_TYPE_SEQUENCE_PATH()).AddElement(0x008, 0x0100); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_TYPE_CODE_SCHEME_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_TYPE_SEQUENCE_PATH()).AddElement(0x008, 0x0102); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_TYPE_CODE_MEANING_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_TYPE_SEQUENCE_PATH()).AddElement(0x008, 0x0104); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENTED_PROPERTY_MODIFIER_SEQUENCE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_TYPE_SEQUENCE_PATH()).AddElement(0x0062, 0x0011); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_MODIFIER_CODE_VALUE_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_MODIFIER_SEQUENCE_PATH()).AddElement(0x008, 0x0100); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_MODIFIER_CODE_SCHEME_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_MODIFIER_SEQUENCE_PATH()).AddElement(0x008, 0x0102); return path; } DICOMTagPath DICOMSegmentationConstants::SEGMENT_MODIFIER_CODE_MEANING_PATH() { static DICOMTagPath path = DICOMTagPath(DICOMSegmentationConstants::SEGMENTED_PROPERTY_MODIFIER_SEQUENCE_PATH()).AddElement(0x008, 0x0104); return path; } } diff --git a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationConstants.h b/Modules/Multilabel/mitkDICOMSegmentationConstants.h similarity index 95% rename from Modules/Multilabel/autoload/IO/mitkDICOMSegmentationConstants.h rename to Modules/Multilabel/mitkDICOMSegmentationConstants.h index c04e44adc4..bbf3d16a63 100644 --- a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationConstants.h +++ b/Modules/Multilabel/mitkDICOMSegmentationConstants.h @@ -1,57 +1,58 @@ /*=================================================================== 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 MITKDICOMSEGMENTATIONCONSTANTS_H_ #define MITKDICOMSEGMENTATIONCONSTANTS_H_ -#include "MitkMultilabelIOExports.h" - #include +#include + + namespace mitk { - struct MITKMULTILABELIO_EXPORT DICOMSegmentationConstants + struct MITKMULTILABEL_EXPORT DICOMSegmentationConstants { static DICOMTagPath SEGMENT_SEQUENCE_PATH(); static DICOMTagPath SEGMENT_NUMBER_PATH(); static DICOMTagPath SEGMENT_LABEL_PATH(); static DICOMTagPath SEGMENT_ALGORITHM_TYPE_PATH(); static DICOMTagPath ANATOMIC_REGION_SEQUENCE_PATH(); static DICOMTagPath ANATOMIC_REGION_CODE_VALUE_PATH(); static DICOMTagPath ANATOMIC_REGION_CODE_SCHEME_PATH(); static DICOMTagPath ANATOMIC_REGION_CODE_MEANING_PATH(); static DICOMTagPath SEGMENTED_PROPERTY_CATEGORY_SEQUENCE_PATH(); static DICOMTagPath SEGMENT_CATEGORY_CODE_VALUE_PATH(); static DICOMTagPath SEGMENT_CATEGORY_CODE_SCHEME_PATH(); static DICOMTagPath SEGMENT_CATEGORY_CODE_MEANING_PATH(); static DICOMTagPath SEGMENTED_PROPERTY_TYPE_SEQUENCE_PATH(); static DICOMTagPath SEGMENT_TYPE_CODE_VALUE_PATH(); static DICOMTagPath SEGMENT_TYPE_CODE_SCHEME_PATH(); static DICOMTagPath SEGMENT_TYPE_CODE_MEANING_PATH(); static DICOMTagPath SEGMENTED_PROPERTY_MODIFIER_SEQUENCE_PATH(); static DICOMTagPath SEGMENT_MODIFIER_CODE_VALUE_PATH(); static DICOMTagPath SEGMENT_MODIFIER_CODE_SCHEME_PATH(); static DICOMTagPath SEGMENT_MODIFIER_CODE_MEANING_PATH(); }; } #endif // MITKDICOMSEGMENTATIONCONSTANTS_H_ diff --git a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationPropertyHelper.cpp b/Modules/Multilabel/mitkDICOMSegmentationPropertyHelper.cpp similarity index 99% rename from Modules/Multilabel/autoload/IO/mitkDICOMSegmentationPropertyHelper.cpp rename to Modules/Multilabel/mitkDICOMSegmentationPropertyHelper.cpp index cbbb6eaf5e..d0fe01d34a 100644 --- a/Modules/Multilabel/autoload/IO/mitkDICOMSegmentationPropertyHelper.cpp +++ b/Modules/Multilabel/mitkDICOMSegmentationPropertyHelper.cpp @@ -1,230 +1,230 @@ /*=================================================================== 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 #include #include #include #include #include #include #include -#include "MitkMultilabelIOExports.h" +#include // us #include #include namespace mitk { - struct MITKMULTILABELIO_EXPORT DICOMSegmentationPropertyHandler + struct MITKMULTILABEL_EXPORT DICOMSegmentationPropertyHandler { static PropertyList::Pointer GetDICOMSegmentationProperties(PropertyList *referencedPropertyList) { PropertyList::Pointer propertyList = PropertyList::New(); // Add DICOM Tag (0008, 0060) Modality "SEG" propertyList->SetProperty(GeneratePropertyNameForDICOMTag(0x0008, 0x0060).c_str(), StringProperty::New("SEG")); // Add DICOM Tag (0008,103E) Series Description propertyList->SetProperty(GeneratePropertyNameForDICOMTag(0x0008, 0x103E).c_str(), StringProperty::New("MITK Segmentation")); // Add DICOM Tag (0070,0084) Content Creator Name propertyList->SetProperty(GeneratePropertyNameForDICOMTag(0x0070, 0x0084).c_str(), StringProperty::New("MITK")); // Add DICOM Tag (0012, 0071) Clinical Trial Series ID propertyList->SetProperty(GeneratePropertyNameForDICOMTag(0x0012, 0x0071).c_str(), StringProperty::New("Session 1")); // Add DICOM Tag (0012,0050) Clinical Trial Time Point ID propertyList->SetProperty(GeneratePropertyNameForDICOMTag(0x0012, 0x0050).c_str(), StringProperty::New("0")); // Add DICOM Tag (0012, 0060) Clinical Trial Coordinating Center Name propertyList->SetProperty(GeneratePropertyNameForDICOMTag(0x0012, 0x0060).c_str(), StringProperty::New("Unknown")); // Check if original image is a DICOM image; if so, store relevant DICOM Tags into the PropertyList of new // segmentation image bool parentIsDICOM = false; for (const auto &element : *(referencedPropertyList->GetMap())) { if (element.first.find("DICOM") == 0) { parentIsDICOM = true; break; } } if (!parentIsDICOM) return propertyList; //====== Patient information ====== // Add DICOM Tag (0010,0010) patient's name; default "No Name" SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0010, 0x0010), "NO NAME"); // Add DICOM Tag (0010,0020) patient id; default "No Name" SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0010, 0x0020), "NO NAME"); // Add DICOM Tag (0010,0030) patient's birth date; no default SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0010, 0x0030)); // Add DICOM Tag (0010,0040) patient's sex; default "U" (Unknown) SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0010, 0x0040), "U"); //====== General study ====== // Add DICOM Tag (0020,000D) Study Instance UID; no default --> MANDATORY! SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0020, 0x000D)); // Add DICOM Tag (0080,0020) Study Date; no default (think about "today") SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0080, 0x0020)); // Add DICOM Tag (0008,0050) Accession Number; no default SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0008, 0x0050)); // Add DICOM Tag (0008,1030) Study Description; no default SetReferenceDICOMProperty(referencedPropertyList, propertyList, DICOMTag(0x0008, 0x1030)); //====== Reference DICOM data ====== // Add reference file paths to referenced DICOM data BaseProperty::Pointer dcmFilesProp = referencedPropertyList->GetProperty("files"); if (dcmFilesProp.IsNotNull()) propertyList->SetProperty("referenceFiles", dcmFilesProp); return propertyList; } static void GetDICOMSegmentProperties(Label *label) { PropertyList::Pointer propertyList = PropertyList::New(); AnatomicalStructureColorPresets::Category category; AnatomicalStructureColorPresets::Type type; AnatomicalStructureColorPresets *anatomicalStructureColorPresets = AnatomicalStructureColorPresets::New(); anatomicalStructureColorPresets->LoadPreset(); for (const auto &preset : anatomicalStructureColorPresets->GetCategoryPresets()) { auto presetOrganName = preset.first; if (label->GetName().compare(presetOrganName) == 0) { category = preset.second; break; } } for (const auto &preset : anatomicalStructureColorPresets->GetTypePresets()) { auto presetOrganName = preset.first; if (label->GetName().compare(presetOrganName) == 0) { type = preset.second; break; } } //------------------------------------------------------------ // Add Segment Sequence tags (0062, 0002) // Segment Number:Identification number of the segment.The value of Segment Number(0062, 0004) shall be unique // within the Segmentation instance in which it is created label->SetProperty(DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_NUMBER_PATH()).c_str(), StringProperty::New(std::to_string(label->GetValue()))); // Segment Label: User-defined label identifying this segment. label->SetProperty(DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_LABEL_PATH()).c_str(), StringProperty::New(label->GetName())); // Segment Algorithm Type: Type of algorithm used to generate the segment. AUTOMATIC SEMIAUTOMATIC MANUAL label->SetProperty(DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_ALGORITHM_TYPE_PATH()).c_str(), StringProperty::New("SEMIAUTOMATIC")); //------------------------------------------------------------ // Add Segmented Property Category Code Sequence tags (0062, 0003): Sequence defining the general category of this // segment. // (0008,0100) Code Value if (!category.codeValue.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_CATEGORY_CODE_VALUE_PATH()).c_str(), StringProperty::New(category.codeValue)); // (0008,0102) Coding Scheme Designator if (!category.codeScheme.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_CATEGORY_CODE_SCHEME_PATH()).c_str(), StringProperty::New(category.codeScheme)); // (0008,0104) Code Meaning if (!category.codeName.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_CATEGORY_CODE_MEANING_PATH()).c_str(), StringProperty::New(category.codeName)); //------------------------------------------------------------ // Add Segmented Property Type Code Sequence (0062, 000F): Sequence defining the specific property type of this // segment. // (0008,0100) Code Value if (!type.codeValue.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_TYPE_CODE_VALUE_PATH()).c_str(), StringProperty::New(type.codeValue)); // (0008,0102) Coding Scheme Designator if (!type.codeScheme.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_TYPE_CODE_SCHEME_PATH()).c_str(), StringProperty::New(type.codeScheme)); // (0008,0104) Code Meaning if (!type.codeName.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_TYPE_CODE_MEANING_PATH()).c_str(), StringProperty::New(type.codeName)); //------------------------------------------------------------ // Add Segmented Property Type Modifier Code Sequence (0062,0011): Sequence defining the modifier of the property // type of this segment. // (0008,0100) Code Value if (!type.modifier.codeValue.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_MODIFIER_CODE_VALUE_PATH()).c_str(), StringProperty::New(type.modifier.codeValue)); // (0008,0102) Coding Scheme Designator if (!type.modifier.codeScheme.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_MODIFIER_CODE_SCHEME_PATH()).c_str(), StringProperty::New(type.modifier.codeScheme)); // (0008,0104) Code Meaning if (!type.modifier.codeName.empty()) label->SetProperty( DICOMTagPathToPropertyName(DICOMSegmentationConstants::SEGMENT_MODIFIER_CODE_MEANING_PATH()).c_str(), StringProperty::New(type.modifier.codeName)); } static void SetReferenceDICOMProperty(PropertyList *referencedPropertyList, PropertyList *propertyList, const DICOMTag &tag, const std::string &defaultString = "") { std::string tagString = GeneratePropertyNameForDICOMTag(tag.GetGroup(), tag.GetElement()); // Get DICOM property from referenced image BaseProperty::Pointer originalProperty = referencedPropertyList->GetProperty(tagString.c_str()); // if property exists, copy the informtaion to the segmentation if (originalProperty.IsNotNull()) propertyList->SetProperty(tagString.c_str(), originalProperty); else // use the default value, if there is one { if (!defaultString.empty()) propertyList->SetProperty(tagString.c_str(), StringProperty::New(defaultString).GetPointer()); } } }; } diff --git a/Modules/Segmentation/CMakeLists.txt b/Modules/Segmentation/CMakeLists.txt index b5d4d165e5..51b663e44a 100644 --- a/Modules/Segmentation/CMakeLists.txt +++ b/Modules/Segmentation/CMakeLists.txt @@ -1,8 +1,8 @@ MITK_CREATE_MODULE( INCLUDE_DIRS Algorithms Controllers DataManagement Interactions Rendering SegmentationUtilities/BooleanOperations SegmentationUtilities/MorphologicalOperations - DEPENDS MitkAlgorithmsExt MitkIpSegmentation MitkIpFunc MitkLegacyAdaptors MitkSurfaceInterpolation MitkGraphAlgorithms MitkContourModel MitkMultilabel MitkMultilabelIO + DEPENDS MitkAlgorithmsExt MitkIpSegmentation MitkIpFunc MitkLegacyAdaptors MitkSurfaceInterpolation MitkGraphAlgorithms MitkContourModel MitkMultilabel PACKAGE_DEPENDS PUBLIC ITK|ITKBinaryMathematicalMorphology+ITKLabelVoting+ITKRegionGrowing+ITKFastMarching+ITKAnisotropicSmoothing+ITKWatersheds ) add_subdirectory(Testing)