18 #include <itkDiscreteGaussianImageFilter.h> 26 unsigned int xDim = parameters->GetXDim();
27 unsigned int yDim = parameters->GetYDim();
28 unsigned int zDim = parameters->GetZDim();
30 unsigned int size = xDim * yDim * zDim;
31 auto* absorptionArray =
new double[size];
32 auto* scatteringArray =
new double[size];
33 auto* anisotropyArray =
new double[size];
34 auto* segmentationArray =
new double[size];
39 for (
unsigned int index = 0; index < size; index++)
42 scatteringArray[index] = parameters->GetBackgroundScattering();
43 anisotropyArray[index] = parameters->GetBackgroundAnisotropy();
44 segmentationArray[index] = SegmentationType::BACKGROUND;
58 void mitk::pa::InSilicoTissueVolume::UpdatePropertyList()
85 Volume::Pointer absorptionVolume,
86 Volume::Pointer scatteringVolume,
87 Volume::Pointer anisotropyVolume,
88 Volume::Pointer segmentationVolume,
89 TissueGeneratorParameters::Pointer tissueParameters,
136 auto* dimensionsOfImage =
new unsigned int[4];
142 dimensionsOfImage[3] =
m_TDim;
144 resultImage->Initialize(TPixel, 4, dimensionsOfImage, 1);
148 resultImage->SetSpacing(spacing);
164 Volume::Pointer absorptionVolume,
165 Volume::Pointer scatteringVolume,
166 Volume::Pointer anisotropyVolume,
167 Volume::Pointer segmentationVolume,
168 TissueGeneratorParameters::Pointer tissueParameters,
172 absorptionVolume, scatteringVolume, anisotropyVolume, segmentationVolume,
173 tissueParameters, propertyList);
174 smartPtr->UnRegister();
231 AddSkinAndAirLayers();
245 std::uniform_real_distribution<double> randomBackgroundAbsorptionDistribution(
248 for (
unsigned int z = 0; z < zDim; z++)
250 for (
unsigned int y = 0; y < yDim; y++)
252 for (
unsigned int x = 0; x < xDim; x++)
263 void mitk::pa::InSilicoTissueVolume::AddSkinAndAirLayers()
276 FillZLayer(x, y, 0, airvoxel,
280 SegmentationType::AIR);
286 FillZLayer(x, y, airvoxel, skinvoxel,
290 SegmentationType::SKIN);
296 void mitk::pa::InSilicoTissueVolume::FillZLayer(
int x,
int y,
double startIdx,
double endIdx,
297 double absorption,
double scattering,
double anisotropy,
300 for (
int z = startIdx; z < endIdx; z++)
313 if (endIdx - z > 0.5)
339 std::random_device randomDevice;
346 if (randomDevice.entropy() > 0.1)
348 rng.seed(randomDevice());
352 rng.seed(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
355 std::normal_distribution<> percentageDistribution(1, percentage / 100);
void SetSpacing(double spacing)
void SetAbsorptionVolume(Volume::Pointer volume)
mitk::pa::Volume::Pointer m_ScatteringVolume
~InSilicoTissueVolume() override
void RandomizeTissueCoefficients(long rngSeed, bool useRngSeed, double percentage)
Volume::Pointer GetSegmentationVolume()
mitk::pa::Volume::Pointer m_AnisotropyVolume
TissueGeneratorParameters::Pointer m_TissueParameters
bool IsInsideVolume(int x, int y, int z)
IsInsideVolume.
void SetSegmentationVolume(Volume::Pointer volume)
mitk::PropertyList::Pointer m_PropertyList
static InSilicoTissueVolume::Pointer New(mitk::pa::Volume::Pointer absorptionVolume, Volume::Pointer scatteringVolume, Volume::Pointer anisotropyVolume, Volume::Pointer segmentationVolume, TissueGeneratorParameters::Pointer tissueParameters, mitk::PropertyList::Pointer propertyList)
double m_InitialBackgroundAbsorption
mitk::Image::Pointer ConvertToMitkImage()
ConvertToMitkImage.
void SetVolumeValues(int x, int y, int z, double absorption, double scattering, double anisotropy, SegmentationType segmentType)
SetVolumeValues sets the values for aborption, scattering and anisotropy at the specified voxel locat...
static IPropertyPersistence * GetPropertyPersistence(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyPersistence instance.
void SetAnisotropyVolume(Volume::Pointer volume)
Volume::Pointer GetAbsorptionVolume()
Volume::Pointer GetAnisotropyVolume()
void SetScatteringVolume(Volume::Pointer volume)
void AddDoubleProperty(std::string label, double value)
AddDoubleProperty adds a persistent property to the volume, which will be exported to the mitk image...
Volume::Pointer GetScatteringVolume()
MITKCORE_EXPORT const ScalarType eps
mitk::pa::Volume::Pointer m_SegmentationVolume
virtual bool AddInfo(const PropertyPersistenceInfo *info, bool overwrite=false)=0
Add persistence info for a specific base data property. If there is already a property info instance ...
InSilicoTissueVolume(TissueGeneratorParameters::Pointer parameters, std::mt19937 *rng)
static Volume::Pointer New(double *data, unsigned int xDim, unsigned int yDim, unsigned int zDim, double spacing)
returns smartpointer reference to a new instance of this objects. The given data array will be freed ...
void AddIntProperty(std::string label, int value)
AddIntProperty adds a persistent property to the volume, which will be exported to the mitk image...
Class for defining the data type of pixels.
mitk::pa::Volume::Pointer m_AbsorptionVolume