diff --git a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacoustic3dVolume.h b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacoustic3dVolume.h index 456e8740ec..582a8ba81c 100644 --- a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacoustic3dVolume.h +++ b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacoustic3dVolume.h @@ -1,134 +1,138 @@ /*=================================================================== 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 MITKPHOTOACOUSTIC3dVOLUME_H #define MITKPHOTOACOUSTIC3dVOLUME_H #include "MitkPhotoacousticSimulationExports.h" //Includes for smart pointer usage #include "mitkCommon.h" #include "itkLightObject.h" #include "mitkPhotoacousticStatefulObject.h" #include namespace mitk { +/** + * @brief The Photoacoustic3dVolume class is designed to encapsulate volumetric information and to provide convenience methods + * for data access and image conversions. + */ class MITKPHOTOACOUSTICSIMULATION_EXPORT Photoacoustic3dVolume : public itk::LightObject, public mitk::PhotoacousticStatefulObject { public: mitkClassMacroItkParent(mitk::Photoacoustic3dVolume, itk::LightObject) mitkNewMacro4Param(Self, double*, int, int, int) /** * @brief ConvertToMitkImage * Creates a new mitk::Image and copies the data array into it. * * @return a mitk::Image::Pointer containing a copy (!) of the data of this array. */ mitk::Image::Pointer ConvertToMitkImage(); /** * @brief GetData. Returns data at wanted position. For performance reasons, this method will not check, * if the specified position it within the array. Please use the GetXDim(), GetYDim() and GetZDim() methods * to check for yourself if necessary. * * @param x * @param y * @param z * @return the data contained within the data array held by this Photoacoustic3dVolume at * positon x|y|z. */ double GetData(int x, int y, int z); /** * @brief SetData * @param data * @param x * @param y * @param z */ void SetData(double data, int x, int y, int z); /** * @brief GetXDim * @return size of x dimension of this Photoacoustic3dVolume */ int GetXDim(); /** * @brief GetYDim * @return size of y dimension of this Photoacoustic3dVolume */ int GetYDim(); /** * @brief GetZDim * @return size of z dimension of this Photoacoustic3dVolume */ int GetZDim(); /** * @brief DeepCopy * @return a deep copy of this Photoacoustic3dVolume. the old volume remains intact and memory is NOT shared * between the objects. */ mitk::Photoacoustic3dVolume::Pointer DeepCopy(); /** * @brief CreateDifferenceImage creates a difference image of this volume and another. * @param other * @param relative if true, the images will be divided, if false they will be subtracted. * @return a new volume. The data of the original images is not affected. */ mitk::Photoacoustic3dVolume::Pointer CreateDifferenceImage(mitk::Photoacoustic3dVolume::Pointer other, bool relative = false); /** * @brief ThresholdImage applies a binary threshold filter to this image. * @param threshold * @return a new binary volume. The data of the current instance will not be affected. */ mitk::Photoacoustic3dVolume::Pointer ThresholdImage(double threshold); protected: /** * @brief Initialize initializes this volume with the given pointer to the data array. * It is assumed, that the array is of dimension xDim|yDim|zDim. * The Photoacoustic3DVolume will handle memory management of the array. * * @param data a pointer to the data array * @param xDim x dimension of the data * @param yDim y dimension of the data * @param zDim z dimension of the data */ Photoacoustic3dVolume(double* data, int xDim, int yDim, int zDim); virtual ~Photoacoustic3dVolume(); const int NUMBER_OF_SPATIAL_DIMENSIONS = 3; double* m_VolumeData; int m_XDim; int m_YDim; int m_ZDim; int GetIndex(int x, int y, int z); }; } #endif // MITKPHOTOACOUSTIC3dVOLUME_H diff --git a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h index 0a4a76c634..475b51f596 100644 --- a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h +++ b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h @@ -1,161 +1,164 @@ /*=================================================================== 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 MITKPHOTOACOUSTICCOMPOSEDVOLUME_H #define MITKPHOTOACOUSTICCOMPOSEDVOLUME_H #include #include #include #include //Includes for smart pointer usage #include "mitkCommon.h" #include "itkLightObject.h" namespace mitk { +/** + * @brief The PhotoacousticComposedVolume class + */ class MITKPHOTOACOUSTICSIMULATION_EXPORT PhotoacousticComposedVolume : public mitk::PhotoacousticVolume { public: mitkClassMacro(mitk::PhotoacousticComposedVolume, mitk::PhotoacousticVolume) itkFactorylessNewMacro(Self) /** * @brief The FluenceValue struct * A simple class struct to make a pair of a data array and a corresponding yOffset. */ struct FluenceValue { double* fluenceValue; double yOffset; int size; FluenceValue() { fluenceValue = nullptr; } ~FluenceValue() { if(fluenceValue!=nullptr) delete[] fluenceValue; fluenceValue = nullptr; } FluenceValue (const FluenceValue &other) { fluenceValue = new double[other.size]; size = other.size; yOffset = other.yOffset; memcpy(fluenceValue, other.fluenceValue, sizeof(double) * size); } const FluenceValue &operator=(const FluenceValue &other) { if(this == &other) return *this; if(fluenceValue!=nullptr) { delete[] fluenceValue; fluenceValue = nullptr; } fluenceValue = new double[other.size]; size = other.size; yOffset = other.yOffset; memcpy(fluenceValue, other.fluenceValue, sizeof(double) * size); return *this; } }; /** * @brief InitializeByNrrd * Initializes this Composed Volume with a ground truth nrrd file. * The given file needs to have equal spacing. * The given file needs all necessary parameters as meta data in the nrrd header. * The given file needs to contain absorption, scattering and anisotrophy coefficients - * in the time steps 0,1, and 2. + * in the time steps 0, 1, and 2. * * @param nrrdFile path to the nrrd file on hard drive */ void InitializeByNrrd(std::string nrrdFile); /** * @brief AddSlice * Adds a MC Simulation nrrd file to this composed volume. * The given file needs to contain the meta information "y-offset". * This method ensures that all added slices are in the correct order * corresponding to their y-offset. * * @param nrrdFile path to the nrrd file on hard drive */ void AddSlice(std::string nrrdFile); /** * @brief ConvertToMitkImage * Creates an mitk image out of this composed volume. * In ths image, all sliced simulation volumes are put into different * time components. * If you need a 3D Reconstruction, use the mitk::SlicedVolumeGenerator. * * @ref mitkSlicedVolumeGenerator.h * * @return a mitk::Image::Pointer containing the data of the composed volume */ mitk::Image::Pointer ConvertToMitkImage(); /** * @brief GetNumberOfFluenceComponents * @return the number of fluence components encapsuled by this ComposedVolume. */ int GetNumberOfFluenceComponents(); /** * @brief GetFluenceValue * @param fluenceComponent * @param x * @param y * @param z * @return the fluence value for a specific fluence component index at the given 3D location. */ double GetFluenceValue(int fluenceComponent, int x, int y, int z); /** * @brief GetYOffsetForFluenceComponent * @param fluenceComponent * @return the y-offset value for a given fluence component index. */ int GetYOffsetForFluenceComponent(int fluenceComponent); void Sort(); protected: PhotoacousticComposedVolume(); ~PhotoacousticComposedVolume(); private: int m_FluenceComponents; std::vector m_FluenceValues; }; } #endif // MITKPHOTOACOUSTICCOMPOSEDVOLUME_H diff --git a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h.autosave similarity index 93% copy from Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h copy to Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h.autosave index 0a4a76c634..2636ab4b3a 100644 --- a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h +++ b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticComposedVolume.h.autosave @@ -1,161 +1,167 @@ /*=================================================================== 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 MITKPHOTOACOUSTICCOMPOSEDVOLUME_H #define MITKPHOTOACOUSTICCOMPOSEDVOLUME_H #include #include #include #include //Includes for smart pointer usage #include "mitkCommon.h" #include "itkLightObject.h" namespace mitk { +/** + * @brief The PhotoacousticComposedVolume class provides the means to systematically collect nrrd files that correspond to + * different simulation slices of the same PhotoacousticVolume. + * + * An instance of this class is needed for the PhotoacousticSlicedVolumeGenerator + */ class MITKPHOTOACOUSTICSIMULATION_EXPORT PhotoacousticComposedVolume : public mitk::PhotoacousticVolume { public: mitkClassMacro(mitk::PhotoacousticComposedVolume, mitk::PhotoacousticVolume) itkFactorylessNewMacro(Self) /** * @brief The FluenceValue struct * A simple class struct to make a pair of a data array and a corresponding yOffset. */ struct FluenceValue { double* fluenceValue; double yOffset; int size; FluenceValue() { fluenceValue = nullptr; } ~FluenceValue() { if(fluenceValue!=nullptr) delete[] fluenceValue; fluenceValue = nullptr; } FluenceValue (const FluenceValue &other) { fluenceValue = new double[other.size]; size = other.size; yOffset = other.yOffset; memcpy(fluenceValue, other.fluenceValue, sizeof(double) * size); } const FluenceValue &operator=(const FluenceValue &other) { if(this == &other) return *this; if(fluenceValue!=nullptr) { delete[] fluenceValue; fluenceValue = nullptr; } fluenceValue = new double[other.size]; size = other.size; yOffset = other.yOffset; memcpy(fluenceValue, other.fluenceValue, sizeof(double) * size); return *this; } }; /** * @brief InitializeByNrrd * Initializes this Composed Volume with a ground truth nrrd file. * The given file needs to have equal spacing. * The given file needs all necessary parameters as meta data in the nrrd header. * The given file needs to contain absorption, scattering and anisotrophy coefficients - * in the time steps 0,1, and 2. + * in the time steps 0, 1, and 2. * * @param nrrdFile path to the nrrd file on hard drive */ void InitializeByNrrd(std::string nrrdFile); /** * @brief AddSlice * Adds a MC Simulation nrrd file to this composed volume. * The given file needs to contain the meta information "y-offset". * This method ensures that all added slices are in the correct order * corresponding to their y-offset. * * @param nrrdFile path to the nrrd file on hard drive */ void AddSlice(std::string nrrdFile); /** * @brief ConvertToMitkImage * Creates an mitk image out of this composed volume. * In ths image, all sliced simulation volumes are put into different * time components. * If you need a 3D Reconstruction, use the mitk::SlicedVolumeGenerator. * * @ref mitkSlicedVolumeGenerator.h * * @return a mitk::Image::Pointer containing the data of the composed volume */ mitk::Image::Pointer ConvertToMitkImage(); /** * @brief GetNumberOfFluenceComponents * @return the number of fluence components encapsuled by this ComposedVolume. */ int GetNumberOfFluenceComponents(); /** * @brief GetFluenceValue * @param fluenceComponent * @param x * @param y * @param z * @return the fluence value for a specific fluence component index at the given 3D location. */ double GetFluenceValue(int fluenceComponent, int x, int y, int z); /** * @brief GetYOffsetForFluenceComponent * @param fluenceComponent * @return the y-offset value for a given fluence component index. */ int GetYOffsetForFluenceComponent(int fluenceComponent); void Sort(); protected: PhotoacousticComposedVolume(); ~PhotoacousticComposedVolume(); private: int m_FluenceComponents; std::vector m_FluenceValues; }; } #endif // MITKPHOTOACOUSTICCOMPOSEDVOLUME_H diff --git a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticFatTissueGenerator.h b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticFatTissueGenerator.h index e4588a47cf..cbded88a7b 100644 --- a/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticFatTissueGenerator.h +++ b/Modules/PhotoacousticSimulation/src/Algorithms/mitkPhotoacousticFatTissueGenerator.h @@ -1,40 +1,46 @@ /*=================================================================== 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 MITKPHOTOACOUSTICFATTISSUEGENERATOR_H #define MITKPHOTOACOUSTICFATTISSUEGENERATOR_H #include "MitkPhotoacousticSimulationExports.h" #include "mitkPhotoacousticVolume.h" #include "mitkPhotoacousticTissueGeneratorParameters.h" namespace mitk { class MITKPHOTOACOUSTICSIMULATION_EXPORT PhotoacousticFatTissueGenerator { public: - static void CreateFatGlobules(mitk::PhotoacousticVolume::Pointer image, mitk::PhotoacousticTissueGeneratorParameters::Pointer, + /** + * @brief CreateFatGlobules + * @param image + * @param parameters + * @param rng + */ + static void CreateFatGlobules(mitk::PhotoacousticVolume::Pointer image, mitk::PhotoacousticTissueGeneratorParameters::Pointer parameters, std::mt19937* rng); private: PhotoacousticFatTissueGenerator(); ~PhotoacousticFatTissueGenerator(); }; } #endif // MITKPHOTOACOUSTICFATTISSUEGENERATOR_H