diff --git a/Modules/ModuleList.cmake b/Modules/ModuleList.cmake index 2f34d737f1..9fc8ca6bba 100644 --- a/Modules/ModuleList.cmake +++ b/Modules/ModuleList.cmake @@ -1,79 +1,80 @@ # 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 SceneSerialization Gizmo GraphAlgorithms Multilabel ImageStatistics ContourModel SurfaceInterpolation Segmentation PlanarFigureSegmentation QtWidgets QtWidgetsExt Chart SegmentationUI Classification DiffusionImaging GPGPU OpenIGTLink IGTBase IGT CameraCalibration OpenCL OpenCVVideoSupport QtOverlays ToFHardware ToFProcessing ToFUI PhotoacousticsHardware PhotoacousticsAlgorithms PhotoacousticsLib + PhotoacousticArtifacts US USUI DicomUI Remeshing Python QtPython Persistence OpenIGTLinkUI IGTUI 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/PhotoacousticArtifacts/CMakeLists.txt b/Modules/PhotoacousticArtifacts/CMakeLists.txt new file mode 100644 index 0000000000..86fe202251 --- /dev/null +++ b/Modules/PhotoacousticArtifacts/CMakeLists.txt @@ -0,0 +1,6 @@ +MITK_CREATE_MODULE( + INCLUDE_DIRS PUBLIC src/Algorithms + DEPENDS MitkCore Eigen +) + +add_subdirectory(test) \ No newline at end of file diff --git a/Modules/PhotoacousticArtifacts/doc/doxygen/Modules.dox b/Modules/PhotoacousticArtifacts/doc/doxygen/Modules.dox new file mode 100644 index 0000000000..2e88f3b1f0 --- /dev/null +++ b/Modules/PhotoacousticArtifacts/doc/doxygen/Modules.dox @@ -0,0 +1,6 @@ +/** + \defgroup MitkPhotoacousticArtifactsModule PhotoacousticArtifacts + \ingroup MITKModules + + \brief Analysis of photoacoustic artifacts +*/ diff --git a/Modules/PhotoacousticArtifacts/files.cmake b/Modules/PhotoacousticArtifacts/files.cmake new file mode 100644 index 0000000000..ad2cba2e4e --- /dev/null +++ b/Modules/PhotoacousticArtifacts/files.cmake @@ -0,0 +1,5 @@ +file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*") + +set(CPP_FILES + Algorithms/mitkPhotoacousticArtifact.cpp +) \ No newline at end of file diff --git a/Modules/PhotoacousticArtifacts/include/mitkPhotoacousticArtifact.h b/Modules/PhotoacousticArtifacts/include/mitkPhotoacousticArtifact.h new file mode 100644 index 0000000000..d7fd7d2605 --- /dev/null +++ b/Modules/PhotoacousticArtifacts/include/mitkPhotoacousticArtifact.h @@ -0,0 +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 mitkPhotoacousticArtifact_h +#define mitkPhotoacousticArtifact_h + +#include +#include +#include +#include +#include + +namespace mitk +{ + class MITKPHOTOACOUSTICARTIFACTS_EXPORT PhotoacousticArtifact final : public mitk::ImageToImageFilter + { + public: + // All classes that derive from an ITK-based MITK class need at least the + // following two macros. Make sure you don't declare the constructor public + // to force clients of your class to follow the ITK convention for + // instantiating classes via the static New() method. + mitkClassMacro(PhotoacousticArtifact, mitk::ImageToImageFilter) + itkFactorylessNewMacro(Self) + + itkSetMacro(SVC, int) + itkGetMacro(SVC, int) + + protected: + + private: + PhotoacousticArtifact(); + ~PhotoacousticArtifact(); + + void GenerateData() override; + + int m_SVC; + }; +} + +#endif mitkPhotoacousticArtifact_h diff --git a/Modules/PhotoacousticArtifacts/src/Algorithms/mitkPhotoacousticArtifact.cpp b/Modules/PhotoacousticArtifacts/src/Algorithms/mitkPhotoacousticArtifact.cpp new file mode 100644 index 0000000000..20ee0a456d --- /dev/null +++ b/Modules/PhotoacousticArtifacts/src/Algorithms/mitkPhotoacousticArtifact.cpp @@ -0,0 +1,105 @@ +/*=================================================================== + +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 + +template +static void ComputeSVD(const Eigen::JacobiSVD<_MatrixType, QRPreconditioner>* inputMatrix, int svdNumber, mitk::Image::Pointer outputImage) +{ + typedef typename Eigen::JacobiSVD<_MatrixType, QRPreconditioner> JacobiSVDType; + + auto svd = JacobiSVDType::New(); + svd->SetInput(inputMatrix); + svd->SetSVD(svdNumber); + JacobiSVDType->compute(); + + MatrixXd m(2, 2); + + MITK_INFO << "Here is the matrix m:" << endl << m << endl; + Eigen::JacobiSVD svd(m, ComputeThinU | ComputeThinV); + MITK_INFO << "Its singular values are:" << endl << svd.singularValues() << endl; + MITK_INFO << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl; + MITK_INFO << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl; + + Eigen::JacobiSVD<_MatrixType, QRPreconditioner>::compute(inputMatrix); + + //This is the tricky part that is done wrong very often.As the image data + // of ITK images and MITK images are binary compatible, we don't need to + // cast or copy the ITK output image.Instead, we just want to reference + // the image data and tell ITK that we took the ownership. + mitk::GrabItkImageMemory(svd->GetOutput(), outputImage); +} + +mitk::PhotoacousticArtifact::PhotoacousticArtifact() + : m_SVC(1) +{ + // TODO output + this->SetPrimaryOutput(mitk::Image::New()); + MITK_INFO << "Test. Hi."; + this->SetNumberOfRequiredInputs(1); +} + +mitk::PhotoacousticArtifact::~PhotoacousticArtifact() +{ +} + +void mitk::PhotoacousticArtifact::GenerateData() +{ + //template + //static void ComputeSVD(inputMatrix, svdNumber, outputImage); + + //mitk::Image::Pointer inputImage = this->GetInput(0); + + //mitk::Image::Pointer outputImage = this->GetOutput(); + + //try + //{ + // // We want to apply an ITK filter to the MITK input image. While MITK + // // images are not templated, ITK images are templated by both pixel type + // // and image dimension. The actual image data is binary compatible, though. + // // MITK provides ITK access macros that enable you to directly operate + // // on MITK images without any superfluous copying. + // // To allow ITK filters to work with different image types at runtime you + // // would be required to instantiate your function templates for each and + // // every expected combination of pixel type and image dimension. Luckily, + // // MITK provides a whole bunch of multiplexer macros to save you doing this + // // manually (see mitkImageAccessByItk.h). + // // These macros range from being completely generic to partly constrained + // // variants. For example, you may want to constrain the image dimension or + // // the pixel type. As your function template is compiled for each allowed + // // combination, compile time and code size may increase dramatically. + // // As a rule of thumb, use a suitable multiplexer macro that is as + // // constrained as possible and yet as generic as necessary. + // // To prevent a combinatorial explosion, image dimension is restricted to + // // 2 and 3 even for the dimension-variable multiplexer macros. + // // Thus, the following multiplexer macro allows for 2-dimensional and + // // 3-dimensional images with an integer pixel type, for example, + // // (un)signed char, short, and int, resulting in a total of 12 distinct + // // combinations. + // AccessIntegralPixelTypeByItk_n(inputImage, ComputeSVD, (m_SVC, outputImage)); + //} + //catch (const mitk::AccessByItkException& e) + //{ + // MITK_ERROR << "Unsupported pixel type or image dimension: " << e.what(); + //} +} diff --git a/Modules/PhotoacousticArtifacts/test/CMakeLists.txt b/Modules/PhotoacousticArtifacts/test/CMakeLists.txt new file mode 100644 index 0000000000..153cd81e2e --- /dev/null +++ b/Modules/PhotoacousticArtifacts/test/CMakeLists.txt @@ -0,0 +1 @@ +MITK_CREATE_MODULE_TESTS() diff --git a/Modules/PhotoacousticArtifacts/test/files.cmake b/Modules/PhotoacousticArtifacts/test/files.cmake new file mode 100644 index 0000000000..26481998dc --- /dev/null +++ b/Modules/PhotoacousticArtifacts/test/files.cmake @@ -0,0 +1,21 @@ +set(MODULE_TESTS + # IMPORTANT: If you plan to deactivate / comment out a test please write a bug number to the commented out line of code. + # + # Example: #mitkMyTest #this test is commented out because of bug 12345 + # + # It is important that the bug is open and that the test will be activated again before the bug is closed. This assures that + # no test is forgotten after it was commented out. If there is no bug for your current problem, please add a new one and + # mark it as critical. + + ################## ON THE FENCE TESTS ################################################# + # none + + ################## DISABLED TESTS ##################################################### + + ################# RUNNING TESTS ####################################################### + + mitkPhotoacousticArtifactsTest.cpp +) + +set(RESOURCE_FILES +) diff --git a/Modules/PhotoacousticArtifacts/test/mitkPhotoacousticArtifactsTest.cpp b/Modules/PhotoacousticArtifacts/test/mitkPhotoacousticArtifactsTest.cpp new file mode 100644 index 0000000000..06b364b463 --- /dev/null +++ b/Modules/PhotoacousticArtifacts/test/mitkPhotoacousticArtifactsTest.cpp @@ -0,0 +1,89 @@ +/*=================================================================== + +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 + +class mitkPhotoacousticArtifactsTestSuite : public mitk::TestFixture +{ + CPPUNIT_TEST_SUITE(mitkPhotoacousticArtifactsTestSuite); + MITK_TEST(TestSimpleSVD); + CPPUNIT_TEST_SUITE_END(); + +private: + + //input und outputbilder, alle parameter für den test + + mitk::PhotoacousticArtifact::Pointer m_Filter; + + mitk::Image::Pointer m_Input; + mitk::Image::Pointer m_ExpectedOutput; + +public: + + void setUp() + { + m_Filter = mitk::PhotoacousticArtifact::New(); + //bild initialisieren --> siehe paVolume.cpp + + unsigned int* dimensions = new unsigned int[3]; + dimensions[0] = 1; + dimensions[1] = 2; + dimensions[2] = 2; + + m_Input = mitk::Image::New(); + double* data = new double[4]; + data[0] = 5; + data[1] = 3; + data[2] = 3; + data[3] = 5; + mitk::PixelType pixelType = mitk::MakeScalarPixelType(); + m_Input->Initialize(pixelType, 3, dimensions); + m_Input->SetImportVolume(data, mitk::Image::ImportMemoryManagementType::CopyMemory); + + delete data; + + m_ExpectedOutput = mitk::Image::New(); + double* dataOut = new double[4]; + dataOut[0] = 1; + dataOut[1] = 1; + dataOut[2] = -1; + dataOut[3] = 1; + m_ExpectedOutput->Initialize(pixelType, 3, dimensions); + m_ExpectedOutput->SetImportVolume(dataOut, mitk::Image::ImportMemoryManagementType::CopyMemory); + + delete dataOut; + } + + void TestSimpleSVD() { + MITK_INFO << "StartTest"; + m_Filter->SetInput(m_Input); + m_Filter->Update(); + mitk::Image::Pointer outputFilter = m_Filter->GetOutput(); + CPPUNIT_ASSERT(mitk::Equal(*outputFilter, *m_ExpectedOutput, mitk::eps, true)); + } + + void tearDown() + { + //bilder deleten, aufräumen, nullptr + } +}; + +MITK_TEST_SUITE_REGISTRATION(mitkPhotoacousticArtifacts) diff --git a/Plugins/PluginList.cmake b/Plugins/PluginList.cmake index eeed58f1f1..09a79f0976 100644 --- a/Plugins/PluginList.cmake +++ b/Plugins/PluginList.cmake @@ -1,100 +1,101 @@ # Plug-ins must be ordered according to their dependencies set(MITK_PLUGINS org.blueberry.core.runtime:ON org.blueberry.core.expressions:OFF org.blueberry.core.commands:OFF org.blueberry.core.jobs:OFF org.blueberry.ui.qt:OFF org.blueberry.ui.qt.help:ON org.blueberry.ui.qt.log:ON org.blueberry.ui.qt.objectinspector:OFF #org.blueberry.test:ON #org.blueberry.uitest:ON #Testing/org.blueberry.core.runtime.tests:ON #Testing/org.blueberry.osgi.tests:ON org.mitk.core.services:ON org.mitk.gui.common:ON org.mitk.planarfigure:ON org.mitk.core.ext:OFF org.mitk.core.jobs:OFF org.mitk.gui.qt.application:ON org.mitk.gui.qt.coreapplication:OFF org.mitk.gui.qt.ext:OFF org.mitk.gui.qt.extapplication:OFF org.mitk.gui.qt.common:ON org.mitk.gui.qt.stdmultiwidgeteditor:ON org.mitk.gui.qt.common.legacy:OFF org.mitk.gui.qt.cmdlinemodules:OFF org.mitk.gui.qt.diffusionimagingapp:OFF org.mitk.gui.qt.datamanager:ON org.mitk.gui.qt.datamanagerlight:OFF org.mitk.gui.qt.properties:ON org.mitk.gui.qt.basicimageprocessing:OFF org.mitk.gui.qt.dicom:OFF org.mitk.gui.qt.dicominspector:OFF org.mitk.gui.qt.diffusionimaging:OFF org.mitk.gui.qt.diffusionimaging.connectomics:OFF org.mitk.gui.qt.diffusionimaging.denoising:OFF org.mitk.gui.qt.diffusionimaging.fiberfox:OFF org.mitk.gui.qt.diffusionimaging.fiberprocessing:OFF org.mitk.gui.qt.diffusionimaging.ivim:OFF org.mitk.gui.qt.diffusionimaging.odfpeaks:OFF org.mitk.gui.qt.diffusionimaging.partialvolume:OFF org.mitk.gui.qt.diffusionimaging.preprocessing:OFF org.mitk.gui.qt.diffusionimaging.reconstruction:OFF org.mitk.gui.qt.diffusionimaging.registration:OFF org.mitk.gui.qt.diffusionimaging.tbss:OFF org.mitk.gui.qt.diffusionimaging.tractography:OFF org.mitk.gui.qt.dosevisualization:OFF org.mitk.gui.qt.geometrytools:OFF org.mitk.gui.qt.igtexamples:OFF org.mitk.gui.qt.igttracking:OFF org.mitk.gui.qt.lasercontrol:OFF org.mitk.gui.qt.openigtlink:OFF org.mitk.gui.qt.imagecropper:OFF org.mitk.gui.qt.imagenavigator:ON org.mitk.gui.qt.viewnavigator:OFF org.mitk.gui.qt.materialeditor:OFF org.mitk.gui.qt.measurementtoolbox:OFF org.mitk.gui.qt.moviemaker:OFF org.mitk.gui.qt.pointsetinteraction:OFF org.mitk.gui.qt.pointsetinteractionmultispectrum:OFF org.mitk.gui.qt.python:OFF org.mitk.gui.qt.remeshing:OFF org.mitk.gui.qt.segmentation:OFF org.mitk.gui.qt.aicpregistration:OFF org.mitk.gui.qt.renderwindowmanager:OFF org.mitk.gui.qt.toftutorial:OFF org.mitk.gui.qt.tofutil:OFF org.mitk.gui.qt.tubegraph:OFF org.mitk.gui.qt.ugvisualization:OFF org.mitk.gui.qt.photoacoustics.pausviewer:OFF org.mitk.gui.qt.photoacoustics.imageprocessing:OFF org.mitk.gui.qt.photoacoustics.simulation:OFF + org.mitk.gui.qt.photoacousticartifacts:OFF org.mitk.gui.qt.ultrasound:OFF org.mitk.gui.qt.volumevisualization:OFF org.mitk.gui.qt.eventrecorder:OFF org.mitk.gui.qt.xnat:OFF org.mitk.gui.qt.igt.app.echotrack:OFF org.mitk.gui.qt.spectrocamrecorder:OFF org.mitk.gui.qt.classificationsegmentation:OFF org.mitk.gui.qt.overlaymanager:OFF org.mitk.gui.qt.igt.app.hummelprotocolmeasurements:OFF org.mitk.gui.qt.multilabelsegmentation:OFF org.mitk.matchpoint.core.helper:OFF org.mitk.gui.qt.matchpoint.algorithm.browser:OFF org.mitk.gui.qt.matchpoint.algorithm.control:OFF org.mitk.gui.qt.matchpoint.algorithm.batch:OFF org.mitk.gui.qt.matchpoint.mapper:OFF org.mitk.gui.qt.matchpoint.framereg:OFF org.mitk.gui.qt.matchpoint.visualizer:OFF org.mitk.gui.qt.matchpoint.evaluator:OFF org.mitk.gui.qt.matchpoint.manipulator:OFF org.mitk.gui.qt.cest:OFF ) diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/CMakeLists.txt b/Plugins/org.mitk.gui.qt.photoacousticartifacts/CMakeLists.txt new file mode 100644 index 0000000000..ce28b9a783 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/CMakeLists.txt @@ -0,0 +1,8 @@ +project(org_mitk_gui_qt_photoacousticartifacts) + +mitk_create_plugin( + EXPORT_DIRECTIVE PHOTOACOUSTIC_ARTIFACTS_EXPORTS + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDS PRIVATE MitkQtWidgetsExt + MODULE_DEPENDS PUBLIC MitkPhotoacousticArtifacts +) diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/UserManual/Manual.dox new file mode 100644 index 0000000000..74e21d8648 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/UserManual/Manual.dox @@ -0,0 +1,20 @@ +/** +\page my_awesomeproject_exampleplugin The Awesome Example Plugin + +\imageMacro{icon.xpm,"Icon of Awesome Example Plugin",2.00} + +\tableofcontents + +\section my_awesomeproject_examplepluginOverview Overview + +Describe the features of your awesome plugin here + +
    +
  • Increases productivity
  • +
  • Creates beautiful images
  • +
  • Generates PhD thesis
  • +
  • Brings world peace
  • +
+ +*/ + diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/UserManual/icon.xpm new file mode 100644 index 0000000000..83e48be4d8 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/UserManual/icon.xpm @@ -0,0 +1,21 @@ +/* XPM */ +static const char * icon_xpm[] = { +"16 16 2 1", +" c #FF0000", +". c #000000", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/doxygen/modules.dox new file mode 100644 index 0000000000..0a267aec8e --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/documentation/doxygen/modules.dox @@ -0,0 +1,16 @@ +/** + \defgroup my_awesomeproject_exampleplugin my.awesomeproject.exampleplugin Plugin + \ingroup MITKPlugins + + \brief Describe your plugin here. + +*/ + +/** + \defgroup my_awesomeproject_exampleplugin_internal Internal + \ingroup my_awesomeproject_exampleplugin + + \brief This subcategory includes the internal classes of the my.awesomeproject.exampleplugin plugin. Other + plugins must not rely on these classes. They contain implementation details and their interface + may change at any time. We mean it. +*/ diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/files.cmake b/Plugins/org.mitk.gui.qt.photoacousticartifacts/files.cmake new file mode 100644 index 0000000000..0a0587bd1c --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/files.cmake @@ -0,0 +1,24 @@ +set(CPP_FILES + src/internal/PhotoacousticArtifactActivator.cpp + src/internal/PhotoacousticArtifact.cpp +) + +set(UI_FILES + src/internal/PhotoacousticArtifactViewControls.ui +) + +set(MOC_H_FILES + src/internal/PhotoacousticArtifactActivator.h + src/internal/PhotoacousticArtifact.h +) + +# List of resource files that can be used by the plugin system without loading +# the actual plugin. For example, the icon that is typically displayed in the +# plugin view menu at the top of the application window. +set(CACHED_RESOURCE_FILES + resources/AwesomeIcon.png + plugin.xml +) + +set(QRC_FILES +) diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.photoacousticartifacts/manifest_headers.cmake new file mode 100644 index 0000000000..6ccb20277e --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/manifest_headers.cmake @@ -0,0 +1,5 @@ +set(Plugin-Name "Photoacoustic Artifact Plugin") +set(Plugin-Version "0.1") +set(Plugin-Vendor "Photoacoustic Artifact Company") +set(Plugin-ContactAddress "http://www.awesomeproject.my") +set(Require-Plugin org.mitk.gui.qt.common) diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/plugin.xml b/Plugins/org.mitk.gui.qt.photoacousticartifacts/plugin.xml new file mode 100644 index 0000000000..78bf63089a --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/plugin.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/resources/AwesomeIcon.png b/Plugins/org.mitk.gui.qt.photoacousticartifacts/resources/AwesomeIcon.png new file mode 100644 index 0000000000..a858653b2a Binary files /dev/null and b/Plugins/org.mitk.gui.qt.photoacousticartifacts/resources/AwesomeIcon.png differ diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifact.cpp b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifact.cpp new file mode 100644 index 0000000000..3920834c23 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifact.cpp @@ -0,0 +1,122 @@ +/*=================================================================== + +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 "PhotoacousticArtifact.h" + +// QT includes (GUI) +#include + +// Berry includes (selection service) +#include +#include + +// MITK includes (general) +//#include +#include +#include + +// Includes for image casting between ITK and MITK +#include +#include + +const std::string PhotoacousticArtifact::VIEW_ID = "photoacousticproject.views.photoacoustic.artifacts"; + +void PhotoacousticArtifact::CreateQtPartControl(QWidget* parent) +{ + m_Controls.setupUi(parent); + connect(m_Controls.applySVDPushButton, SIGNAL(clicked()), this, SLOT(ProcessSelectedImage())); +} + +void PhotoacousticArtifact::SetFocus() +{ + m_Controls.applySVDPushButton->setFocus(); +} + +void PhotoacousticArtifact::OnSelectionChanged(berry::IWorkbenchPart::Pointer, + const QList& dataNodes) +{ + for (const auto& dataNode : dataNodes) + { + if (dataNode.IsNotNull() && dynamic_cast(dataNode->GetData()) != nullptr) + { + m_Controls.selectImageLabel->setVisible(false); + return; + } + } + m_Controls.selectImageLabel->setVisible(true); +} + +void PhotoacousticArtifact::ProcessSelectedImage() +{ + auto selectedDataNodes = this->GetDataManagerSelection(); + + if (selectedDataNodes.empty()) + return; + + auto firstSelectedDataNode = selectedDataNodes.front(); + + if (firstSelectedDataNode.IsNull()) + { + QMessageBox::information(nullptr, "Photoacoustic Artifact", + "Please load and select an image before starting image processing."); + return; + } + + auto data = firstSelectedDataNode->GetData(); + + if (data != nullptr) + { + mitk::Image::Pointer image = dynamic_cast(data); + + // Something is selected and it contains data, but is it an image? + if (image.IsNotNull()) + { + auto imageName = firstSelectedDataNode->GetName(); + auto numberSVC = m_Controls.numberSVCSpinBox->value(); + + MITK_INFO << "Process image \"" << imageName << "\" ..."; + + auto svc = mitk::PhotoacousticArtifact::New(); + svc->SetInput(image); + //svc->SetNumberSVC(svc); + + svc->Update(); + + mitk::Image::Pointer processedImage = svc->GetOutput(); + + if (processedImage.IsNull() || !processedImage->IsInitialized()) + return; + + MITK_INFO << " done"; + + // Stuff the resulting image into a data node, set some properties, + // and add it to the data storage, which will eventually display the + // image in the application. + auto processedImageDataNode = mitk::DataNode::New(); + processedImageDataNode->SetData(processedImage); + + //QString name = QString("%1 (SVC: %2)").arg(imageName.c_str()).arg(svc); + //processedImageDataNode->SetName(name.toStdString()); + + mitk::LevelWindow levelWindow; + + if (firstSelectedDataNode->GetLevelWindow(levelWindow)) + processedImageDataNode->SetLevelWindow(levelWindow); + + this->GetDataStorage()->Add(processedImageDataNode); + } + } +} diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifact.h b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifact.h new file mode 100644 index 0000000000..cf410a1b53 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifact.h @@ -0,0 +1,47 @@ +/*=================================================================== + +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 PhotoacousticArtifact_h +#define PhotoacousticArtifact_h + +#include +#include +#include +#include + +class PhotoacousticArtifact : public QmitkAbstractView +{ + Q_OBJECT + +public: + static const std::string VIEW_ID; + + void CreateQtPartControl(QWidget* parent) override; + + private slots: + void ProcessSelectedImage(); + +private: + void SetFocus() override; + + void OnSelectionChanged( + berry::IWorkbenchPart::Pointer source, + const QList& dataNodes) override; + + Ui::PhotoacousticArtifactViewControls m_Controls; +}; + +#endif diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactActivator.cpp b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactActivator.cpp new file mode 100644 index 0000000000..9d8a9682a1 --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactActivator.cpp @@ -0,0 +1,28 @@ +/*=================================================================== + +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 "PhotoacousticArtifactActivator.h" +#include "PhotoacousticArtifact.h" + +void PhotoacousticArtifactActivator::start(ctkPluginContext* context) +{ + BERRY_REGISTER_EXTENSION_CLASS(PhotoacousticArtifact, context) +} + +void PhotoacousticArtifactActivator::stop(ctkPluginContext* context) +{ + Q_UNUSED(context) +} diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactActivator.h b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactActivator.h new file mode 100644 index 0000000000..039479b60c --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactActivator.h @@ -0,0 +1,35 @@ +/*=================================================================== + +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 PhotoacousticArtifactActivator_h +#define PhotoacousticArtifactActivator_h + +#include + +class PhotoacousticArtifactActivator + : public QObject, + public ctkPluginActivator +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "photoacoustic_artifact_activator") + Q_INTERFACES(ctkPluginActivator) + +public: + void start(ctkPluginContext* context); + void stop(ctkPluginContext* context); +}; + +#endif diff --git a/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactViewControls.ui b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactViewControls.ui new file mode 100644 index 0000000000..9497b098ea --- /dev/null +++ b/Plugins/org.mitk.gui.qt.photoacousticartifacts/src/internal/PhotoacousticArtifactViewControls.ui @@ -0,0 +1,83 @@ + + + PhotoacousticArtifactViewControls + + + + 0 + 0 + 403 + 427 + + + + Photoacoustic Artifacts + + + + + + QLabel { color: rgb(255, 0, 0) } + + + Please select a RAW data image. + + + + + + + + + 0 + + + 500 + + + + + + + Choose a number of SVC(s): + + + + + + + + + Apply SVD + + + + + + + Reconstruct image + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 220 + + + + + + + + + +