diff --git a/Modules/Core/test/mitkPointSetLocaleTest.cpp b/Modules/Core/test/mitkPointSetLocaleTest.cpp index 41c4cf2447..990d3f014a 100644 --- a/Modules/Core/test/mitkPointSetLocaleTest.cpp +++ b/Modules/Core/test/mitkPointSetLocaleTest.cpp @@ -1,198 +1,198 @@ /*=================================================================== 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. ===================================================================*/ // Testing #include "mitkTestFixture.h" #include "mitkTestingMacros.h" // std includes #include #include // MITK includes #include "mitkIOUtil.h" #include "mitkPointSet.h" #include "mitkStandardFileLocations.h" // VTK includes #include // stream includes #include #include class mitkPointSetLocaleTestSuite : public mitk::TestFixture { CPPUNIT_TEST_SUITE(mitkPointSetLocaleTestSuite); MITK_TEST(TestIfGermanLocaleUsed_Success); CPPUNIT_TEST_SUITE_END(); private: typedef std::list StringList; StringList m_AllLocales; mitk::PointSet::Pointer m_RefPointSet; mitk::Point3D m_RefPoint; mitk::Point3D m_Point; mitk::PointSet::Pointer m_PointSet; bool ChangeLocale(const std::string &locale) { try { MITK_TEST_OUTPUT(<< "\n** Changing locale from " << setlocale(LC_ALL, nullptr) << " to '" << locale << "'"); setlocale(LC_ALL, locale.c_str()); std::locale l(locale.c_str()); std::cin.imbue(l); std::cout.imbue(l); return true; } catch (...) { MITK_TEST_OUTPUT(<< "Could not activate locale " << locale << "\n"); return false; } } void ReaderLocaleTest(mitk::Point3D &refPoint, std::string filename) { MITK_TEST_OUTPUT(<< "---- Reader Test ---- "); m_PointSet = mitk::IOUtil::Load(filename); if (m_PointSet->GetPointIfExists(0, &m_Point)) { CPPUNIT_ASSERT_MESSAGE("read x correct", fabs(refPoint[0] - m_Point[0]) < 0.00001); CPPUNIT_ASSERT_MESSAGE("read y correct", fabs(refPoint[1] - m_Point[1]) < 0.00001); CPPUNIT_ASSERT_MESSAGE("read z correct", fabs(refPoint[2] - m_Point[2]) < 0.00001); } else { MITK_TEST_FAILED_MSG(<< "File " << filename << " can not be read - test will not applied."); return; } } void WriterLocaleTest(mitk::Point3D &refPoint, std::string filename) { MITK_TEST_OUTPUT(<< "---- Writer Test---- "); // create pointset m_RefPointSet = mitk::PointSet::New(); m_RefPointSet->InsertPoint(0, refPoint); std::string tmpFilePath = mitk::IOUtil::CreateTemporaryFile("testPointSet_XXXXXX.mps"); // write point set mitk::IOUtil::Save(m_RefPointSet, tmpFilePath); std::ifstream stream(tmpFilePath.c_str()); // compare two .mps files std::ifstream refStream(filename.c_str()); CPPUNIT_ASSERT_MESSAGE("Read reference point set", refStream); CPPUNIT_ASSERT_MESSAGE("Read point set", stream); bool differ = false; if (stream.is_open() && refStream.is_open()) { std::string streamLine; std::string refStreamLine; while (!stream.eof() && !refStream.eof()) { getline(stream, streamLine); getline(refStream, refStreamLine); if (streamLine.compare(refStreamLine) != 0) { differ = true; break; } } stream.close(); refStream.close(); } CPPUNIT_ASSERT_MESSAGE("Write point set correct", !differ); } public: void setUp() { m_RefPointSet = mitk::PointSet::New(); // create locale list m_AllLocales.push_back("de_DE"); m_AllLocales.push_back("de_DE.utf8"); m_AllLocales.push_back("de_DE.UTF-8"); m_AllLocales.push_back("de_DE@euro"); m_AllLocales.push_back("German_Germany"); m_RefPoint[0] = 32.2946; m_RefPoint[1] = -17.7359; m_RefPoint[2] = 29.6502; } void tearDown() { m_RefPoint[0] = 0; m_RefPoint[1] = 0; m_RefPoint[2] = 0; m_AllLocales.clear(); } void TestIfGermanLocaleUsed_Success() { // create reference point set m_RefPointSet->SetPoint(0, m_RefPoint); // QuickFix for MAC OS X // See for more the Bug #3894 comments #if defined(__APPLE__) || defined(MACOSX) - alllocales.push_back("C"); + m_AllLocales.push_back("C"); #endif // write a reference file using the "C" locale once ChangeLocale("C"); std::string referenceFilePath = mitk::IOUtil::CreateTemporaryFile("refPointSet_XXXXXX.mps"); MITK_INFO << "Reference PointSet in " << referenceFilePath; // write point set mitk::IOUtil::Save(m_RefPointSet, referenceFilePath); unsigned int numberOfTestedGermanLocales(0); for (auto iter = m_AllLocales.begin(); iter != m_AllLocales.end(); ++iter) { if (ChangeLocale(*iter)) { ++numberOfTestedGermanLocales; WriterLocaleTest(m_RefPoint, referenceFilePath); ReaderLocaleTest(m_RefPoint, referenceFilePath); } } if (numberOfTestedGermanLocales == 0) { MITK_TEST_OUTPUT(<< "Warning: No German locale was found on the system."); } } }; MITK_TEST_SUITE_REGISTRATION(mitkPointSetLocale) diff --git a/Modules/ModelFit/src/Common/mitkFresnel.cpp b/Modules/ModelFit/src/Common/mitkFresnel.cpp index 4a533b10f4..60b9cd21bc 100644 --- a/Modules/ModelFit/src/Common/mitkFresnel.cpp +++ b/Modules/ModelFit/src/Common/mitkFresnel.cpp @@ -1,287 +1,286 @@ /*=================================================================== 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. ===================================================================*/ /**************************************************************************** * fresnel.c - * Calculation of Fresnel integrals by expansion to Chebyshev series * Expansions are taken from the book * Y.L. Luke. Mathematical functions and their approximations. * Moscow, "Mir", 1980. PP. 145-149 (Russian edition) **************************************************************************** */ #include -static const double sqrt_pi_2 = 1.2533141373155002512078826424; /* sqrt(pi/2) */ static const double sqrt_2_pi = 0.7978845608028653558798921199; /* sqrt(2/pi) */ static const double _1_sqrt_2pi = 0.3989422804014326779399460599; /* 1/sqrt(2*pi) */ static const double pi_2 = 1.5707963267948966192313216916; /* pi/2 */ static double f_data_a[18] = { 0.76435138664186000189, -0.43135547547660179313, 0.43288199979726653054, -0.26973310338387111029, 0.08416045320876935378, -0.01546524484461381958, 0.00187855423439822018, -0.00016264977618887547, 0.00001057397656383260, -0.00000053609339889243, 0.00000002181658454933, -0.00000000072901621186, 0.00000000002037332546, -0.00000000000048344033, 0.00000000000000986533, -0.00000000000000017502, 0.00000000000000000272, -0.00000000000000000004 }; static double f_data_b[17] = { 0.63041404314570539241, -0.42344511405705333544, 0.37617172643343656625, -0.16249489154509567415, 0.03822255778633008694, -0.00564563477132190899, 0.00057454951976897367, -0.00004287071532102004, 0.00000245120749923299, -0.00000011098841840868, 0.00000000408249731696, -0.00000000012449830219, 0.00000000000320048425, -0.00000000000007032416, 0.00000000000000133638, -0.00000000000000002219, 0.00000000000000000032 }; static double fresnel_cos_0_8(double x) { double x_8 = x / 8.0; double xx = 2.0*x_8*x_8 - 1.0; double t0 = 1.0; double t1 = xx; double sumC = f_data_a[0] + f_data_a[1] * t1; double t2; int n; for (n = 2; n < 18; n++) { t2 = 2.0*xx*t1 - t0; sumC += f_data_a[n] * t2; t0 = t1; t1 = t2; } return _1_sqrt_2pi * sqrt(x)*sumC; } static double fresnel_sin_0_8(double x) { double x_8 = x / 8.0; double xx = 2.0*x_8*x_8 - 1.0; double t0 = 1.; double t1 = xx; double ot1 = x_8; double ot2 = 2.0*x_8*t1 - ot1; double sumS = f_data_b[0] * ot1 + f_data_b[1] * ot2; int n; double t2; for (n = 2; n < 17; n++) { t2 = 2.0*xx*t1 - t0; ot1 = ot2; ot2 = 2.0*x_8*t2 - ot1; sumS += f_data_b[n] * ot2; t0 = t1; t1 = t2; } return _1_sqrt_2pi * sqrt(x)*sumS; } static double f_data_e[41] = { 0.97462779093296822410, -0.02424701873969321371, 0.00103400906842977317, -0.00008052450246908016, 0.00000905962481966582, -0.00000131016996757743, 0.00000022770820391497, -0.00000004558623552026, 0.00000001021567537083, -0.00000000251114508133, 0.00000000066704761275, -0.00000000018931512852, 0.00000000005689898935, -0.00000000001798219359, 0.00000000000594162963, -0.00000000000204285065, 0.00000000000072797580, -0.00000000000026797428, 0.00000000000010160694, -0.00000000000003958559, 0.00000000000001581262, -0.00000000000000646411, 0.00000000000000269981, -0.00000000000000115038, 0.00000000000000049942, -0.00000000000000022064, 0.00000000000000009910, -0.00000000000000004520, 0.00000000000000002092, -0.00000000000000000982, 0.00000000000000000467, -0.00000000000000000225, 0.00000000000000000110, -0.00000000000000000054, 0.00000000000000000027, -0.00000000000000000014, 0.00000000000000000007, -0.00000000000000000004, 0.00000000000000000002, -0.00000000000000000001, 0.00000000000000000001 }; static double f_data_f[35] = { 0.99461545179407928910, -0.00524276766084297210, 0.00013325864229883909, -0.00000770856452642713, 0.00000070848077032045, -0.00000008812517411602, 0.00000001359784717148, -0.00000000246858295747, 0.00000000050925789921, -0.00000000011653400634, 0.00000000002906578309, -0.00000000000779847361, 0.00000000000222802542, -0.00000000000067239338, 0.00000000000021296411, -0.00000000000007041482, 0.00000000000002419805, -0.00000000000000861080, 0.00000000000000316287, -0.00000000000000119596, 0.00000000000000046444, -0.00000000000000018485, 0.00000000000000007527, -0.00000000000000003131, 0.00000000000000001328, -0.00000000000000000574, 0.00000000000000000252, -0.00000000000000000113, 0.00000000000000000051, -0.00000000000000000024, 0.00000000000000000011, -0.00000000000000000005, 0.00000000000000000002, -0.00000000000000000001, 0.00000000000000000001 }; static double fresnel_cos_8_inf(double x) { double xx = 128.0 / (x*x) - 1.0; /* 2.0*(8/x)^2 - 1 */ double t0 = 1.0; double t1 = xx; double sumP = f_data_e[0] + f_data_e[1] * t1; double sumQ = f_data_f[0] + f_data_f[1] * t1; double t2; int n; for (n = 2; n < 35; n++) { t2 = 2.0*xx*t1 - t0; sumP += f_data_e[n] * t2; /* sumP += f_data_e[n]*ChebyshevT(n,xx) */ sumQ += f_data_f[n] * t2; /* sumQ += f_data_f[n]*ChebyshevT(n,xx) */ t0 = t1; t1 = t2; } for (n = 35; n < 41; n++) { t2 = 2.0*xx*t1 - t0; sumP += f_data_e[n] * t2; /* sumP += f_data_e[n]*ChebyshevT(n,xx) */ t0 = t1; t1 = t2; } return 0.5 - _1_sqrt_2pi * (0.5*sumP*cos(x) / x - sumQ * sin(x)) / sqrt(x); } static double fresnel_sin_8_inf(double x) { double xx = 128.0 / (x*x) - 1.0; /* 2.0*(8/x)^2 - 1 */ double t0 = 1.0; double t1 = xx; double sumP = f_data_e[0] + f_data_e[1] * t1; double sumQ = f_data_f[0] + f_data_f[1] * t1; double t2; int n; for (n = 2; n < 35; n++) { t2 = 2.0*xx*t1 - t0; sumP += f_data_e[n] * t2; /* sumP += f_data_e[n]*ChebyshevT(n,xx) */ sumQ += f_data_f[n] * t2; /* sumQ += f_data_f[n]*ChebyshevT(n,xx) */ t0 = t1; t1 = t2; } for (n = 35; n < 41; n++) { t2 = 2.0*xx*t1 - t0; sumP += f_data_e[n] * t2; /* sumQ += f_data_f[n]*ChebyshevT(n,xx) */ t0 = t1; t1 = t2; } return 0.5 - _1_sqrt_2pi * (0.5*sumP*sin(x) / x + sumQ * cos(x)) / sqrt(x); } namespace mitk { double fresnel_c(double x) { double xx = x * x*pi_2; double ret_val; if (xx <= 8.0) ret_val = fresnel_cos_0_8(xx); else ret_val = fresnel_cos_8_inf(xx); return (x < 0.0) ? -ret_val : ret_val; } double fresnel_s(double x) { double xx = x * x*pi_2; double ret_val; if (xx <= 8.0) ret_val = fresnel_sin_0_8(xx); else ret_val = fresnel_sin_8_inf(xx); return (x < 0.0) ? -ret_val : ret_val; } double fresnel_c2(double x) { return fresnel_c(x*sqrt_2_pi); } double fresnel_s2(double x) { return fresnel_s(x*sqrt_2_pi); } } diff --git a/Modules/PhotoacousticsAlgorithms/test/mitkBandpassFilterTest.cpp b/Modules/PhotoacousticsAlgorithms/test/mitkBandpassFilterTest.cpp index b3b319f35b..42c3210944 100644 --- a/Modules/PhotoacousticsAlgorithms/test/mitkBandpassFilterTest.cpp +++ b/Modules/PhotoacousticsAlgorithms/test/mitkBandpassFilterTest.cpp @@ -1,194 +1,194 @@ /*=================================================================== 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. ===================================================================*/ #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include "../ITKFilter/ITKUltrasound/itkFFT1DRealToComplexConjugateImageFilter.h" #include "mitkImageCast.h" #include "mitkITKImageImport.h" #include "itkComplexToModulusImageFilter.h" class mitkBandpassFilterTestSuite : public mitk::TestFixture { CPPUNIT_TEST_SUITE(mitkBandpassFilterTestSuite); MITK_TEST(testHighPass); MITK_TEST(testLowPass); CPPUNIT_TEST_SUITE_END(); private: mitk::BandpassFilter::Pointer m_BandpassFilter; const unsigned int NUM_ITERATIONS = 15; const unsigned int DATA_XY_DIM = 512; const unsigned int DATA_Z_DIM = 8; const float TIME_SPACING = 0.00625; // [us] const float FREQUENCY_RESOLUTION = 2 * M_PI / (TIME_SPACING * DATA_XY_DIM); // [MHz] const float MAX_FREQUENCY = FREQUENCY_RESOLUTION * DATA_XY_DIM / 2.f; // [MHz] const float HIGHPASS_FREQENCY = MAX_FREQUENCY * 0.8f; // [MHz] const float LOWPASS_FREQENCY = MAX_FREQUENCY * 0.1f; // [MHz] const float ALPHA = 0; // 0 = box, 1 = von Hann; changing this may make the test invalid const float EPSILON_FFT = 0.00001f; public: void setUp() override { m_BandpassFilter = mitk::BandpassFilter::New(); } void test(float HighPass, float LowPass, float HighPassAlpha, float LowPassAlpha, bool useLow, bool useHigh) { std::random_device r; std::default_random_engine randGen(r()); std::uniform_real_distribution randDistrHighPass(HighPass * 0.01f, HighPass * 0.2f); std::uniform_real_distribution randDistrLowPass(LowPass * 1.5f, LowPass * 2.f); float* data = new float[DATA_XY_DIM*DATA_XY_DIM*DATA_Z_DIM]; mitk::Image::Pointer inputImage = mitk::Image::New(); unsigned int dimension[3]{ DATA_XY_DIM, DATA_XY_DIM, DATA_Z_DIM }; inputImage->Initialize(mitk::MakeScalarPixelType(), 3, dimension); mitk::Vector3D spacing; spacing[0] = 1; spacing[1] = TIME_SPACING; spacing[2] = 1; inputImage->SetSpacing(spacing); for (unsigned int iteration = 0; iteration < NUM_ITERATIONS; ++iteration) { // fill image with zeros for (unsigned int i = 0; i < DATA_XY_DIM*DATA_XY_DIM*DATA_Z_DIM; ++i) { data[i] = 0; } // write specific frequencies to the image if (useHigh) addFrequency(randDistrHighPass(randGen), TIME_SPACING, data, dimension); if (useLow) addFrequency(randDistrLowPass(randGen), TIME_SPACING, data, dimension); inputImage->SetImportVolume(data, 0, 0, mitk::Image::ImportMemoryManagementType::CopyMemory); m_BandpassFilter->SetInput(inputImage); if (!useHigh) HighPass = 0; m_BandpassFilter->SetHighPass(HighPass); if(!useLow) LowPass = MAX_FREQUENCY; m_BandpassFilter->SetLowPass(LowPass); m_BandpassFilter->SetHighPassAlpha(HighPassAlpha); m_BandpassFilter->SetLowPassAlpha(LowPassAlpha); m_BandpassFilter->Update(); mitk::Image::Pointer outputImage = m_BandpassFilter->GetOutput(); // do a fourier transform, and check whether the part of the image that has been filtered is zero typedef itk::Image< float, 3 > RealImageType; RealImageType::Pointer image; mitk::CastToItkImage(outputImage, image); typedef itk::FFT1DRealToComplexConjugateImageFilter ForwardFFTFilterType; // typedef ForwardFFTFilterType::OutputImageType ComplexImageType; ForwardFFTFilterType::Pointer forwardFFTFilter = ForwardFFTFilterType::New(); forwardFFTFilter->SetInput(image); forwardFFTFilter->SetDirection(1); forwardFFTFilter->UpdateOutputInformation(); forwardFFTFilter->Update(); auto fftResult = forwardFFTFilter->GetOutput(); // the resulting image should consist only of zeros, as we filtered the frequencies out for (unsigned int z = 0; z < DATA_Z_DIM; ++z) { for (unsigned int y = 0; y < DATA_XY_DIM / 2; ++y) { if (y < (unsigned int)std::floor(HighPass / FREQUENCY_RESOLUTION) || y > (unsigned int)std::ceil(LowPass / FREQUENCY_RESOLUTION)) { for (unsigned int x = 0; x < DATA_XY_DIM; ++x) { // unsigned int outPos = x + y * DATA_XY_DIM + z * DATA_XY_DIM * DATA_XY_DIM; std::complex value = fftResult->GetPixel({ x,y,z }); CPPUNIT_ASSERT_MESSAGE(std::string("Expected 0, got (" + std::to_string(value.real()) + " + " + std::to_string(value.imag()) + "i) at " + std::to_string(x)+"-"+std::to_string(y)+"-"+std::to_string(z)), - (abs(value.real()) < EPSILON_FFT) && (abs(value.imag() < EPSILON_FFT))); + (value.real() < EPSILON_FFT) && (value.imag() < EPSILON_FFT)); } } } for (unsigned int y = DATA_XY_DIM / 2; y < DATA_XY_DIM; ++y) { if (y > DATA_XY_DIM - (unsigned int)std::floor(HighPass / FREQUENCY_RESOLUTION) || y < DATA_XY_DIM - (unsigned int)std::ceil(LowPass / FREQUENCY_RESOLUTION)) { for (unsigned int x = 0; x < DATA_XY_DIM; ++x) { // unsigned int outPos = x + y * DATA_XY_DIM + z * DATA_XY_DIM * DATA_XY_DIM; std::complex value = fftResult->GetPixel({ x,y,z }); CPPUNIT_ASSERT_MESSAGE(std::string("Expected 0, got (" + std::to_string(value.real()) + " + " + std::to_string(value.imag()) + "i) at " + std::to_string(x) + "-" + std::to_string(y) + "-" + std::to_string(z)), - (abs(value.real()) < EPSILON_FFT) && (abs(value.imag() < EPSILON_FFT))); + (value.real() < EPSILON_FFT) && (value.imag() < EPSILON_FFT)); } } } } } delete[] data; } // write a fixed-frequency signal to the image void addFrequency(float freq, float timeSpacing, float* data, unsigned int* dim) { for (unsigned int z = 0; z < dim[2]; ++z) { for (unsigned int y = 0; y < dim[1]; ++y) { for (unsigned int x = 0; x < dim[0]; ++x) { data[x + y*dim[0] + z*dim[0] * dim[1]] += std::sin(freq * timeSpacing * y); } } } } void testHighPass() { MITK_INFO << "Performing HighPass test"; test(HIGHPASS_FREQENCY, 0, ALPHA, ALPHA, false, true); } void testLowPass() { MITK_INFO << "Performing LowPass test"; test(0, LOWPASS_FREQENCY, ALPHA, ALPHA, true, false); } void tearDown() override { m_BandpassFilter = nullptr; } }; MITK_TEST_SUITE_REGISTRATION(mitkBandpassFilter) diff --git a/Modules/PhotoacousticsLib/include/mitkPAVessel.h b/Modules/PhotoacousticsLib/include/mitkPAVessel.h index f7e4b777a7..579e3e407e 100644 --- a/Modules/PhotoacousticsLib/include/mitkPAVessel.h +++ b/Modules/PhotoacousticsLib/include/mitkPAVessel.h @@ -1,118 +1,117 @@ /*=================================================================== 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 MITKVESSEL_H #define MITKVESSEL_H #include "mitkVector.h" #include "mitkPAVesselMeanderStrategy.h" #include "mitkPAInSilicoTissueVolume.h" #include "mitkPAVector.h" #include "mitkPAVesselProperties.h" #include "mitkPAVesselDrawer.h" #include //Includes for smart pointer usage #include "mitkCommon.h" #include "itkLightObject.h" namespace mitk { namespace pa { class MITKPHOTOACOUSTICSLIB_EXPORT Vessel : public itk::LightObject { public: mitkClassMacroItkParent(Vessel, itk::LightObject) mitkNewMacro1Param(Self, VesselProperties::Pointer) /** * Callback function definition of a VesselMeanderStrategy */ typedef void (VesselMeanderStrategy::*CalculateNewVesselPositionCallback) (Vector::Pointer, Vector::Pointer, double, std::mt19937*); /** * @brief ExpandVessel makes this Vessel expand one step in its current direction. * After expanding, the vessel will draw itself into the given InSilicoTissueVolume. * * @param volume volume for the vessel to draw itself in * @param calculateNewPosition a callback function of the VesselMeanderStrategy class. * It is used to calculate the final position after taking the step. * @param bendingFactor a metric of how much the Vessel should bend. If set to 0 the vessel will go in a straight line. */ void ExpandVessel(mitk::pa::InSilicoTissueVolume::Pointer volume, CalculateNewVesselPositionCallback calculateNewPosition, double bendingFactor, std::mt19937* rng); /** * @brief CanBifurcate * @return true if the Vessel is ready to Bifurcate() */ bool CanBifurcate(); /** * @brief Bifurcate bifurcates this vessel into two new ones. Makes sure that the volume of the vessels stays the same. * * @return a new vessel split up from the current one. */ Vessel::Pointer Bifurcate(std::mt19937* rng); /** * @brief IsFinished * @return true if the vessel cannot expand any further */ bool IsFinished(); itkGetConstMacro(VesselProperties, VesselProperties::Pointer); protected: Vessel(VesselProperties::Pointer parameters); ~Vessel() override; private: const double MINIMUM_VESSEL_RADIUS = 0.1; - const double SCALING_FACTOR = 0.33; const double NEW_RADIUS_MINIMUM_RELATIVE_SIZE = 0.6; const double NEW_RADIUS_MAXIMUM_RELATIVE_SIZE = 0.8; VesselMeanderStrategy::Pointer m_VesselMeanderStrategy; bool m_Finished; double m_WalkedDistance; std::uniform_real_distribution<> m_RangeDistribution; std::uniform_real_distribution<> m_SignDistribution; std::uniform_real_distribution<> m_RadiusRangeDistribution; int GetSign(std::mt19937* rng); VesselProperties::Pointer m_VesselProperties; VesselDrawer::Pointer m_VesselDrawer; }; /** * @brief Equal A function comparing two vessels for beeing equal * * @param rightHandSide A vessel to be compared * @param leftHandSide A vessel to be compared * @param eps tolarence for comparison. You can use mitk::eps in most cases. * @param verbose flag indicating if the user wants detailed console output or not. * @return true, if all subsequent comparisons are true, false otherwise */ MITKPHOTOACOUSTICSLIB_EXPORT bool Equal(const Vessel::Pointer leftHandSide, const Vessel::Pointer rightHandSide, double eps, bool verbose); } } #endif // MITKVESSEL_H