diff --git a/Modules/Core/files.cmake b/Modules/Core/files.cmake index ab6009196e..1a3e5ca9d2 100644 --- a/Modules/Core/files.cmake +++ b/Modules/Core/files.cmake @@ -1,312 +1,314 @@ file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*") set(CPP_FILES mitkCoreActivator.cpp mitkCoreObjectFactoryBase.cpp mitkCoreObjectFactory.cpp mitkCoreServices.cpp mitkException.cpp Algorithms/mitkBaseDataSource.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Algorithms/mitkCompareImageDataFilter.cpp Algorithms/mitkConvert2Dto3DImageFilter.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkExtractSliceFilter.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkImageToSurfaceFilter.cpp Algorithms/mitkMultiComponentImageDataComparisonFilter.cpp Algorithms/mitkPlaneGeometryDataToSurfaceFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToImageFilter.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkPlanePositionManager.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp Controllers/mitkSlicesCoordinator.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkLayerController.cpp + DataManagement/mitkAnatomicalStructureColorPresets.cpp DataManagement/mitkArbitraryTimeGeometry.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkApplyTransformMatrixOperation.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseGeometry.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkChannelDescriptor.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkDataNode.cpp DataManagement/mitkDataStorage.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkFloatPropertyExtension.cpp DataManagement/mitkGeometry3D.cpp DataManagement/mitkGeometryData.cpp DataManagement/mitkGeometryTransformHolder.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkImageAccessorBase.cpp DataManagement/mitkImageCaster.cpp DataManagement/mitkImageCastPart1.cpp DataManagement/mitkImageCastPart2.cpp DataManagement/mitkImageCastPart3.cpp DataManagement/mitkImageCastPart4.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkImageDescriptor.cpp DataManagement/mitkImageReadAccessor.cpp DataManagement/mitkImageStatisticsHolder.cpp DataManagement/mitkImageVtkAccessor.cpp DataManagement/mitkImageVtkReadAccessor.cpp DataManagement/mitkImageVtkWriteAccessor.cpp DataManagement/mitkImageWriteAccessor.cpp DataManagement/mitkIntPropertyExtension.cpp DataManagement/mitkIPersistenceService.cpp DataManagement/mitkIPropertyAliases.cpp DataManagement/mitkIPropertyDescriptions.cpp DataManagement/mitkIPropertyExtensions.cpp DataManagement/mitkIPropertyFilters.cpp DataManagement/mitkIPropertyPersistence.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLine.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTableProperty.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMaterial.cpp DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModifiedLock.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFirstLevel.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateSource.cpp DataManagement/mitkNumericConstants.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneGeometryData.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkPointSetShapeProperty.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyAliases.cpp DataManagement/mitkPropertyDescriptions.cpp DataManagement/mitkPropertyExtension.cpp DataManagement/mitkPropertyExtensions.cpp DataManagement/mitkPropertyFilter.cpp DataManagement/mitkPropertyFilters.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkPropertyListReplacedObserver.cpp DataManagement/mitkPropertyNameHelper.cpp DataManagement/mitkPropertyObserver.cpp DataManagement/mitkPropertyPersistence.cpp DataManagement/mitkPropertyPersistenceInfo.cpp DataManagement/mitkProportionalTimeGeometry.cpp DataManagement/mitkRenderingModeProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkRestorePlanePositionOperation.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkScaleOperation.cpp DataManagement/mitkShaderProperty.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTimeGeometry.cpp DataManagement/mitkTransferFunction.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTemporoSpatialStringProperty.cpp DataManagement/mitkVector.cpp DataManagement/mitkVectorProperty.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkVtkVolumeRenderingProperty.cpp DataManagement/mitkWeakPointerProperty.cpp Interactions/mitkAction.cpp Interactions/mitkBindDispatcherInteractor.cpp Interactions/mitkCrosshairPositionEvent.cpp Interactions/mitkDataInteractor.cpp Interactions/mitkDispatcher.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkDisplayInteractor.cpp Interactions/mitkEventConfig.cpp Interactions/mitkEventFactory.cpp Interactions/mitkEventRecorder.cpp Interactions/mitkEventStateMachine.cpp Interactions/mitkInteractionEventConst.cpp Interactions/mitkInteractionEvent.cpp Interactions/mitkInteractionEventHandler.cpp Interactions/mitkInteractionEventObserver.cpp Interactions/mitkInteractionKeyEvent.cpp Interactions/mitkInteractionPositionEvent.cpp Interactions/mitkInternalEvent.cpp Interactions/mitkMouseDoubleClickEvent.cpp Interactions/mitkMouseModeSwitcher.cpp Interactions/mitkMouseMoveEvent.cpp Interactions/mitkMousePressEvent.cpp Interactions/mitkMouseReleaseEvent.cpp Interactions/mitkMouseWheelEvent.cpp Interactions/mitkPointSetDataInteractor.cpp Interactions/mitkSinglePointDataInteractor.cpp Interactions/mitkStateMachineAction.cpp Interactions/mitkStateMachineCondition.cpp Interactions/mitkStateMachineContainer.cpp Interactions/mitkStateMachineState.cpp Interactions/mitkStateMachineTransition.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkVtkInteractorStyle.cxx Interactions/mitkXML2EventParser.cpp IO/mitkAbstractFileIO.cpp IO/mitkAbstractFileReader.cpp IO/mitkAbstractFileWriter.cpp IO/mitkCustomMimeType.cpp IO/mitkDicomSeriesReader.cpp IO/mitkDicomSeriesReaderService.cpp IO/mitkDicomSR_GantryTiltInformation.cpp IO/mitkDicomSR_ImageBlockDescriptor.cpp IO/mitkDicomSR_LoadDICOMRGBPixel4D.cpp IO/mitkDicomSR_LoadDICOMRGBPixel.cpp IO/mitkDicomSR_LoadDICOMScalar4D.cpp IO/mitkDicomSR_LoadDICOMScalar.cpp IO/mitkDicomSR_SliceGroupingResult.cpp IO/mitkFileReader.cpp IO/mitkFileReaderRegistry.cpp IO/mitkFileReaderSelector.cpp IO/mitkFileReaderWriterBase.cpp IO/mitkFileWriter.cpp IO/mitkFileWriterRegistry.cpp IO/mitkFileWriterSelector.cpp IO/mitkGeometry3DToXML.cpp IO/mitkIFileIO.cpp IO/mitkIFileReader.cpp IO/mitkIFileWriter.cpp IO/mitkGeometryDataReaderService.cpp IO/mitkGeometryDataWriterService.cpp IO/mitkImageGenerator.cpp IO/mitkImageVtkLegacyIO.cpp IO/mitkImageVtkXmlIO.cpp IO/mitkIMimeTypeProvider.cpp IO/mitkIOConstants.cpp IO/mitkIOMimeTypes.cpp IO/mitkIOUtil.cpp IO/mitkItkImageIO.cpp IO/mitkItkLoggingAdapter.cpp IO/mitkLegacyFileReaderService.cpp IO/mitkLegacyFileWriterService.cpp IO/mitkLocaleSwitch.cpp IO/mitkLog.cpp IO/mitkMimeType.cpp IO/mitkMimeTypeProvider.cpp IO/mitkOperation.cpp IO/mitkPixelType.cpp IO/mitkPointSetReaderService.cpp IO/mitkPointSetWriterService.cpp IO/mitkProportionalTimeGeometryToXML.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSurfaceStlIO.cpp IO/mitkSurfaceVtkIO.cpp IO/mitkSurfaceVtkLegacyIO.cpp IO/mitkSurfaceVtkXmlIO.cpp IO/mitkVtkLoggingAdapter.cpp Rendering/mitkAbstractOverlayLayouter.cpp Rendering/mitkBaseRenderer.cpp #Rendering/mitkGLMapper.cpp Moved to deprecated LegacyGL Module Rendering/mitkGradientBackground.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/mitkIShaderRepository.cpp Rendering/mitkManufacturerLogo.cpp Rendering/mitkMapper.cpp Rendering/mitkOverlay.cpp Rendering/mitkOverlayManager.cpp Rendering/mitkPlaneGeometryDataMapper2D.cpp Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp Rendering/mitkPointSetVtkMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowFrame.cpp #Rendering/mitkSurfaceGLMapper2D.cpp Moved to deprecated LegacyGL Module Rendering/mitkSurfaceVtkMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkVtkMapper.cpp Rendering/mitkVtkOverlay2D.cpp Rendering/mitkVtkOverlay3D.cpp Rendering/mitkVtkOverlay.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkLevelWindowFilter.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkNeverTranslucentTexture.cpp ) set(RESOURCE_FILES Interactions/globalConfig.xml Interactions/DisplayInteraction.xml Interactions/DisplayConfig.xml Interactions/DisplayConfigPACS.xml Interactions/DisplayConfigPACSPan.xml Interactions/DisplayConfigPACSScroll.xml Interactions/DisplayConfigPACSZoom.xml Interactions/DisplayConfigPACSLevelWindow.xml Interactions/DisplayConfigMITK.xml Interactions/DisplayConfigMITKNoCrosshair.xml Interactions/DisplayConfigMITKRotation.xml Interactions/DisplayConfigMITKRotationUnCoupled.xml Interactions/DisplayConfigMITKSwivel.xml Interactions/DisplayConfigMITKLimited.xml Interactions/PointSet.xml Interactions/Legacy/StateMachine.xml Interactions/Legacy/DisplayConfigMITKTools.xml Interactions/PointSetConfig.xml mitkLevelWindowPresets.xml +mitkAnatomicalStructureColorPresets.xml ) diff --git a/Modules/Core/include/mitkAnatomicalStructureColorPresets.h b/Modules/Core/include/mitkAnatomicalStructureColorPresets.h new file mode 100644 index 0000000000..c81fe604f1 --- /dev/null +++ b/Modules/Core/include/mitkAnatomicalStructureColorPresets.h @@ -0,0 +1,109 @@ +/*=================================================================== + +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 ANATOMICALSTRUCTURECOLORPRESETS_H_HEADER +#define ANATOMICALSTRUCTURECOLORPRESETS_H_HEADER + +#include +#include +#include +#include +#include + +namespace mitk { + +class MITKCORE_EXPORT AnatomicalStructureColorPresets : public vtkXMLParser +{ + + struct Category + { + std::string codeValue; + std::string codeScheme; + std::string codeName; + Category() : codeValue(""), codeScheme(""), codeName(""){} + Category(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){} + }; + + struct Type + { + struct Modifier + { + std::string codeValue; + std::string codeScheme; + std::string codeName; + Modifier() : codeValue(""), codeScheme(""), codeName(""){} + Modifier(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){} + }; + std::string codeValue; + std::string codeScheme; + std::string codeName; + Modifier modifier; + Type() : codeValue(""), codeScheme(""), codeName(""){ modifier = Modifier(); } + Type(std::string value, std::string scheme, std::string name) : codeValue(value), codeScheme(scheme), codeName(name){ modifier = Modifier(); } + //Type(std::string value, std::string scheme, std::string name, Modifier modifier) : codeValue(value), codeScheme(scheme), codeName(name), modifier(modifier){} + }; + +public: + static AnatomicalStructureColorPresets *New(); + vtkTypeMacro(AnatomicalStructureColorPresets,vtkXMLParser); + + bool LoadPreset(); + bool LoadPreset(std::string fileName); + Category getCategory(std::string name); + Type getType(std::string name); + Color getColor(std::string name); + std::map& getCategoryPresets(); + std::map& getTypePresets(); + std::map& getColorPresets(); + void newPresets(std::map newCategory, std::map newType, std::map); + +protected: + AnatomicalStructureColorPresets(); + ~AnatomicalStructureColorPresets(); + +private: + //##Documentation + //## @brief method used in XLM-Reading; gets called when a start-tag is read + void StartElement (const char *elementName, const char **atts) override; + + //void saveXML(mitk::XMLWriter& xmlWriter); + void save(); + + //##Documentation + //## @brief reads an XML-String-Attribute + std::string ReadXMLStringAttribut( std::string name, const char** atts); + + static const std::string PRESET; + static const std::string CATEGORY; + static const std::string TYPE; + static const std::string MODIFIER; + static const std::string COLOR; + static const std::string CODE_VALUE; + static const std::string CODE_SCHEME; + static const std::string CODE_NAME; + + static const std::string COLOR_R; + static const std::string COLOR_G; + static const std::string COLOR_B; + + std::string m_presetName; + std::map m_Category; + std::map m_Type; + std::map m_Color; + std::string m_XmlFileName; +}; +} +#endif diff --git a/Modules/Core/resource/mitkAnatomicalStructureColorPresets.xml b/Modules/Core/resource/mitkAnatomicalStructureColorPresets.xml new file mode 100644 index 0000000000..23335e682b --- /dev/null +++ b/Modules/Core/resource/mitkAnatomicalStructureColorPresets.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Modules/Core/src/DataManagement/mitkAnatomicalStructureColorPresets.cpp b/Modules/Core/src/DataManagement/mitkAnatomicalStructureColorPresets.cpp new file mode 100644 index 0000000000..ecef3a6107 --- /dev/null +++ b/Modules/Core/src/DataManagement/mitkAnatomicalStructureColorPresets.cpp @@ -0,0 +1,195 @@ +/*=================================================================== + +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 "mitkAnatomicalStructureColorPresets.h" +#include + +#include "usGetModuleContext.h" +#include "usModuleContext.h" +#include "usModule.h" +#include "usModuleResource.h" +#include "usModuleResourceStream.h" + +namespace mitk { + + const std::string AnatomicalStructureColorPresets::PRESET = "preset"; + const std::string AnatomicalStructureColorPresets::CATEGORY = "category"; + const std::string AnatomicalStructureColorPresets::TYPE = "type"; + const std::string AnatomicalStructureColorPresets::MODIFIER = "modifier"; + const std::string AnatomicalStructureColorPresets::COLOR = "color"; + + const std::string AnatomicalStructureColorPresets::CODE_VALUE = "code_value"; + const std::string AnatomicalStructureColorPresets::CODE_SCHEME = "code_scheme"; + const std::string AnatomicalStructureColorPresets::CODE_NAME = "code_name"; + + const std::string AnatomicalStructureColorPresets::COLOR_R = "rgb_r"; + const std::string AnatomicalStructureColorPresets::COLOR_G = "rgb_g"; + const std::string AnatomicalStructureColorPresets::COLOR_B = "rgb_b"; + + + vtkStandardNewMacro(AnatomicalStructureColorPresets); + + AnatomicalStructureColorPresets::AnatomicalStructureColorPresets() + { + } + + AnatomicalStructureColorPresets::~AnatomicalStructureColorPresets() + { + } + + bool AnatomicalStructureColorPresets::LoadPreset() + { + us::ModuleResource presetResource = us::GetModuleContext()->GetModule()->GetResource("mitkAnatomicalStructureColorPresets.xml"); + if (!presetResource) return false; + + us::ModuleResourceStream presetStream(presetResource); + vtkXMLParser::SetStream(&presetStream); + if (!vtkXMLParser::Parse()) + { +#ifdef INTERDEBUG + MITK_INFO<<"AnatomicalStructureColorPresets::LoadPreset xml file cannot parse!"<& AnatomicalStructureColorPresets::getCategoryPresets() + { + return m_Category; + } + + std::map& AnatomicalStructureColorPresets::getTypePresets() + { + return m_Type; + } + + std::map& AnatomicalStructureColorPresets::getColorPresets() + { + return m_Color; + } + + void AnatomicalStructureColorPresets::save() + { + //XMLWriter writer(m_XmlFileName.c_str()); + //saveXML(writer); + } + + void AnatomicalStructureColorPresets::newPresets(std::map newCategory, std::map newType, std::map newColor) + { + m_Category = newCategory; + m_Type = newType; + m_Color = newColor; + save(); + } + +} diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationOrganNamesHandling.cpp b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationOrganNamesHandling.cpp index 82fbb1e296..383a65d00b 100644 --- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationOrganNamesHandling.cpp +++ b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationOrganNamesHandling.cpp @@ -1,101 +1,62 @@ /*=================================================================== 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 "mitkAnatomicalStructureColorPresets.h" QStringList QmitkSegmentationView::GetDefaultOrganColorString() { QStringList organColors; - AppendToOrganList(organColors, "Ankle", 255, 255, 153); - AppendToOrganList(organColors, "Appendix", 161, 107, 54); - AppendToOrganList(organColors, "Blood vessels", 255, 49, 49); - AppendToOrganList(organColors, "Bone", 255, 255, 153); - AppendToOrganList(organColors, "Brain", 255, 156, 202); - AppendToOrganList(organColors, "Bronchial tree", 0, 160, 209); - AppendToOrganList(organColors, "Coccyx", 255, 255, 153); - AppendToOrganList(organColors, "Colon", 161, 107, 54); - AppendToOrganList(organColors, "Cyst", 150, 189, 228); - AppendToOrganList(organColors, "Elbow", 255, 255, 153); - AppendToOrganList(organColors, "Eye", 18, 7, 161); - AppendToOrganList(organColors, "Fallopian tube", 161, 19, 39); - AppendToOrganList(organColors, "Fat", 237, 255, 41); - AppendToOrganList(organColors, "Gall Bladder", 86, 127, 24); - AppendToOrganList(organColors, "Hand", 255, 222, 199); - AppendToOrganList(organColors, "Heart", 153, 0, 0); - AppendToOrganList(organColors, "Hip", 255, 255, 153); - AppendToOrganList(organColors, "Kidney", 250, 89, 0); - AppendToOrganList(organColors, "Knee", 255, 255, 153); - AppendToOrganList(organColors, "Larynx", 102, 0, 0); - AppendToOrganList(organColors, "Liver", 194, 142, 0); - AppendToOrganList(organColors, "Lung", 107, 220, 255); - AppendToOrganList(organColors, "Lymph node", 10, 250, 56); - AppendToOrganList(organColors, "Muscle", 102, 0, 0); - AppendToOrganList(organColors, "Nerve", 255, 234, 79); - AppendToOrganList(organColors, "Nose", 255, 222, 199); - AppendToOrganList(organColors, "Oesophagus", 102, 0, 0); - AppendToOrganList(organColors, "Ovaries", 234, 0, 117); - AppendToOrganList(organColors, "Pancreas", 249, 171, 61); - AppendToOrganList(organColors, "Pelvis", 255, 255, 153); - AppendToOrganList(organColors, "Penis", 255, 222, 199); - AppendToOrganList(organColors, "Pharynx", 102, 0, 0); - AppendToOrganList(organColors, "Prostate", 209, 163, 117); - AppendToOrganList(organColors, "Rectum", 161, 107, 54); - AppendToOrganList(organColors, "Sacrum", 255, 255, 153); - AppendToOrganList(organColors, "Seminal vesicle", 199, 232, 255); - AppendToOrganList(organColors, "Shoulder", 255, 255, 153); - AppendToOrganList(organColors, "Spinal cord", 255, 234, 79); - AppendToOrganList(organColors, "Spleen", 249, 108, 61); - AppendToOrganList(organColors, "Stomach", 161, 107, 54); - AppendToOrganList(organColors, "Teeth", 255, 252, 216); - AppendToOrganList(organColors, "Testicles", 199, 232, 255); - AppendToOrganList(organColors, "Thyroid", 255, 179, 184); - AppendToOrganList(organColors, "Tongue", 102, 0, 0); - AppendToOrganList(organColors, "Tumor", 147, 112, 17); - AppendToOrganList(organColors, "Urethra", 197, 204, 0); - AppendToOrganList(organColors, "Urinary bladder", 197, 204, 0); - AppendToOrganList(organColors, "Uterus", 161, 19, 39); - AppendToOrganList(organColors, "Vagina", 161, 19, 39); - AppendToOrganList(organColors, "Vertebra", 255, 255, 153); - AppendToOrganList(organColors, "Wrist", 255, 255, 153); + mitk::AnatomicalStructureColorPresets* anatomicalStructureColorPresets = mitk::AnatomicalStructureColorPresets::New(); + anatomicalStructureColorPresets->LoadPreset(); + + std::map organColorPreset = anatomicalStructureColorPresets->getColorPresets(); + for (auto iter = organColorPreset.begin(); iter != organColorPreset.end(); iter++) + { + QString organName = ((*iter).first.c_str()); + QColor color = QColor((*iter).second.GetRed(), (*iter).second.GetGreen(), (*iter).second.GetBlue()); + + AppendToOrganList(organColors, organName, color); + } return organColors; } void QmitkSegmentationView::UpdateOrganList(QStringList& organColors, const QString& organname, mitk::Color color) { QString listElement( organname + QColor(color.GetRed() * 255 , color.GetGreen() * 255 , color.GetBlue() * 255).name() ); // remove previous definition if necessary int oldIndex = organColors.indexOf( QRegExp(QRegExp::escape(organname) + "#......", Qt::CaseInsensitive)); if (oldIndex < 0 || organColors.at(oldIndex) != listElement ) { if (oldIndex >= 0) { organColors.removeAt( oldIndex ); } // add colored organ name AND sort list organColors.append( listElement ); organColors.sort(); } } -void QmitkSegmentationView::AppendToOrganList(QStringList& organColors, const QString& organname, int r, int g, int b) +void QmitkSegmentationView::AppendToOrganList(QStringList& organColors, const QString& organname, QColor& color) { - organColors.append( organname + QColor(r, g, b).name() ); + organColors.append( organname + color.name() ); } diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.h b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.h index 332939e9cd..81a8662779 100644 --- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.h +++ b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkSegmentationView.h @@ -1,182 +1,182 @@ /*=================================================================== 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 QmitkSegmentationView_h #define QmitkSegmentationView_h #include "QmitkFunctionality.h" #include #include "ui_QmitkSegmentationControls.h" class QmitkRenderWindow; /** * \ingroup ToolManagerEtAl * \ingroup org_mitk_gui_qt_segmentation_internal * \warning Implementation of this class is split up into two .cpp files to make things more compact. Check both this file and QmitkSegmentationOrganNamesHandling.cpp */ class QmitkSegmentationView : public QmitkFunctionality { Q_OBJECT public: QmitkSegmentationView(); virtual ~QmitkSegmentationView(); typedef std::map NodeTagMapType; /*! \brief Invoked when the DataManager selection changed */ virtual void OnSelectionChanged(mitk::DataNode* node); virtual void OnSelectionChanged(std::vector nodes) override; // reaction to new segmentations being created by segmentation tools void NewNodesGenerated(); void NewNodeObjectsGenerated(mitk::ToolManager::DataVectorType*); // QmitkFunctionality's activate/deactivate virtual void Activated() override; virtual void Deactivated() override; virtual void Visible() override; // QmitkFunctionality's changes regarding THE QmitkStdMultiWidget virtual void StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget) override; virtual void StdMultiWidgetNotAvailable() override; virtual void StdMultiWidgetClosed(QmitkStdMultiWidget& stdMultiWidget) override; // BlueBerry's notification about preference changes (e.g. from a dialog) virtual void OnPreferencesChanged(const berry::IBerryPreferences* prefs) override; // observer to mitk::RenderingManager's RenderingManagerViewsInitializedEvent event void RenderingManagerReinitialized(); // observer to mitk::SliceController's SliceRotation event void SliceRotation(const itk::EventObject&); static const std::string VIEW_ID; protected slots: void OnPatientComboBoxSelectionChanged(const mitk::DataNode* node); void OnSegmentationComboBoxSelectionChanged(const mitk::DataNode* node); // reaction to the button "New segmentation" void CreateNewSegmentation(); void OnManualTool2DSelected(int id); void OnWorkingNodeVisibilityChanged(); // called if a node's binary property has changed void OnBinaryPropertyChanged(); void OnShowMarkerNodes(bool); void OnTabWidgetChanged(int); protected: // a type for handling lists of DataNodes typedef std::vector NodeList; // set available multiwidget void SetMultiWidget(QmitkStdMultiWidget* multiWidget); // actively query the current selection of data manager //void PullCurrentDataManagerSelection(); // reactions to selection events from data manager (and potential other senders) //void BlueBerrySelectionChanged(berry::IWorkbenchPart::Pointer sourcepart, berry::ISelection::ConstPointer selection); mitk::DataNode::Pointer FindFirstRegularImage( std::vector nodes ); mitk::DataNode::Pointer FindFirstSegmentation( std::vector nodes ); // propagate BlueBerry selection to ToolManager for manual segmentation void SetToolManagerSelection(const mitk::DataNode* referenceData, const mitk::DataNode* workingData); // checks if given render window aligns with the slices of given image bool IsRenderWindowAligned(QmitkRenderWindow* renderWindow, mitk::Image* image); // make sure all images/segmentations look as selected by the users in this view's preferences void ForceDisplayPreferencesUponAllImages(); // decorates a DataNode according to the user preference settings void ApplyDisplayOptions(mitk::DataNode* node); // GUI setup void CreateQtPartControl(QWidget* parent) override; void ResetMouseCursor( ); void SetMouseCursor(const us::ModuleResource&, int hotspotX, int hotspotY ); void SetToolSelectionBoxesEnabled(bool); bool m_MouseCursorSet; // handling of a list of known (organ name, organ color) combination // ATTENTION these methods are defined in QmitkSegmentationOrganNamesHandling.cpp QStringList GetDefaultOrganColorString(); void UpdateOrganList(QStringList& organColors, const QString& organname, mitk::Color colorname); - void AppendToOrganList(QStringList& organColors, const QString& organname, int r, int g, int b); + void AppendToOrganList(QStringList& organColors, const QString& organname, QColor& color); // If a contourmarker is selected, the plane in the related widget will be reoriented according to the marker`s geometry void OnContourMarkerSelected (const mitk::DataNode* node); void NodeRemoved(const mitk::DataNode* node) override; void NodeAdded(const mitk::DataNode *node) override; bool CheckForSameGeometry(const mitk::DataNode*, const mitk::DataNode*) const; void UpdateWarningLabel(QString text/*, bool overwriteExistingText = true*/); // the Qt parent of our GUI (NOT of this object) QWidget* m_Parent; // our GUI Ui::QmitkSegmentationControls * m_Controls; // THE currently existing QmitkStdMultiWidget QmitkStdMultiWidget * m_MultiWidget; unsigned long m_VisibilityChangedObserverTag; bool m_DataSelectionChanged; NodeTagMapType m_WorkingDataObserverTags; NodeTagMapType m_BinaryPropertyObserverTags; unsigned int m_RenderingManagerObserverTag; bool m_AutoSelectionEnabled; mitk::NodePredicateOr::Pointer m_IsOfTypeImagePredicate; mitk::NodePredicateProperty::Pointer m_IsBinaryPredicate; mitk::NodePredicateNot::Pointer m_IsNotBinaryPredicate; mitk::NodePredicateAnd::Pointer m_IsNotABinaryImagePredicate; mitk::NodePredicateAnd::Pointer m_IsABinaryImagePredicate; mitk::NodePredicateOr::Pointer m_IsASegmentationImagePredicate; mitk::NodePredicateAnd::Pointer m_IsAPatientImagePredicate; }; #endif /*QMITKsegmentationVIEW_H_*/