25 CPPUNIT_TEST_SUITE(mitkTemporoSpatialStringPropertyTestSuite);
34 CPPUNIT_TEST_SUITE_END();
43 refJSON =
"{\"values\":[{\"t\":0, \"z\":0, \"value\":\"v_0_0\"}, {\"t\":3, \"z\":0, \"value\":\"v_3_0\"}, "
44 "{\"t\":3, \"z\":2, \"value\":\"v_3_2\"}, {\"t\":6, \"z\":1, \"value\":\"v_6_1\"}]}";
46 refProp->SetValue(0, 0,
"v_0_0");
47 refProp->SetValue(3, 0,
"v_3_0");
48 refProp->SetValue(3, 2,
"v_3_2");
49 refProp->SetValue(6, 1,
"v_6_1");
52 void tearDown()
override {}
55 CPPUNIT_ASSERT(refProp->GetValue() ==
"v_0_0");
57 CPPUNIT_ASSERT(refProp->GetValue(3, 0) ==
"v_3_0");
58 CPPUNIT_ASSERT(refProp->GetValue(3, 2) ==
"v_3_2");
59 CPPUNIT_ASSERT(refProp->GetValue(3, 1,
false,
true) ==
"v_3_0");
60 CPPUNIT_ASSERT(refProp->GetValue(3, 5,
false,
true) ==
"v_3_2");
62 CPPUNIT_ASSERT(refProp->GetValueBySlice(0) ==
"v_0_0");
63 CPPUNIT_ASSERT(refProp->GetValueBySlice(4,
true) ==
"v_0_0");
65 CPPUNIT_ASSERT(refProp->GetValueByTimeStep(3) ==
"v_3_0");
66 CPPUNIT_ASSERT(refProp->GetValueByTimeStep(6) ==
"v_6_1");
67 CPPUNIT_ASSERT(refProp->GetValueByTimeStep(5,
true) ==
"v_3_0");
69 CPPUNIT_ASSERT(refProp->GetValueAsString() ==
"v_0_0");
71 CPPUNIT_ASSERT(refProp->GetAvailableTimeSteps().size() == 3);
72 CPPUNIT_ASSERT(refProp->GetAvailableTimeSteps()[0] == 0);
73 CPPUNIT_ASSERT(refProp->GetAvailableTimeSteps()[1] == 3);
74 CPPUNIT_ASSERT(refProp->GetAvailableTimeSteps()[2] == 6);
76 CPPUNIT_ASSERT(refProp->GetAvailableSlices(0).size() == 1);
77 CPPUNIT_ASSERT(refProp->GetAvailableSlices(0)[0] == 0);
78 CPPUNIT_ASSERT(refProp->GetAvailableSlices(3).size() == 2);
79 CPPUNIT_ASSERT(refProp->GetAvailableSlices(3)[0] == 0);
80 CPPUNIT_ASSERT(refProp->GetAvailableSlices(3)[1] == 2);
82 CPPUNIT_ASSERT(refProp->GetAvailableSlices(2).size() == 0);
87 CPPUNIT_ASSERT(refProp->HasValue());
89 CPPUNIT_ASSERT(refProp->HasValue(3, 0));
90 CPPUNIT_ASSERT(refProp->HasValue(3, 2));
91 CPPUNIT_ASSERT(refProp->HasValue(3, 1,
false,
true));
92 CPPUNIT_ASSERT(refProp->HasValue(3, 5,
false,
true));
93 CPPUNIT_ASSERT(!refProp->HasValue(3, 1));
94 CPPUNIT_ASSERT(!refProp->HasValue(3, 5));
95 CPPUNIT_ASSERT(refProp->HasValue(4, 2,
true,
true));
96 CPPUNIT_ASSERT(refProp->HasValue(4, 2,
true,
false));
97 CPPUNIT_ASSERT(!refProp->HasValue(4, 2,
false,
true));
99 CPPUNIT_ASSERT(refProp->HasValueBySlice(0));
100 CPPUNIT_ASSERT(refProp->HasValueBySlice(4,
true));
101 CPPUNIT_ASSERT(!refProp->HasValueBySlice(4));
103 CPPUNIT_ASSERT(refProp->HasValueByTimeStep(3));
104 CPPUNIT_ASSERT(refProp->HasValueByTimeStep(6));
105 CPPUNIT_ASSERT(refProp->HasValueByTimeStep(5,
true));
106 CPPUNIT_ASSERT(!refProp->HasValueByTimeStep(5));
111 CPPUNIT_ASSERT_NO_THROW(refProp->SetValue(8, 9,
"v_8_9"));
112 CPPUNIT_ASSERT(refProp->GetValue(8, 9) ==
"v_8_9");
114 CPPUNIT_ASSERT_NO_THROW(refProp->SetValue(
"newValue"));
115 CPPUNIT_ASSERT(refProp->GetValue(0, 0) ==
"newValue");
116 CPPUNIT_ASSERT(refProp->GetAvailableTimeSteps().size() == 1);
117 CPPUNIT_ASSERT(refProp->GetAvailableSlices(0).size() == 1);
123 CPPUNIT_ASSERT(refJSON ==
146 CPPUNIT_ASSERT(*tsProp == *refProp);
MITK_TEST_SUITE_REGISTRATION(mitkImageToItk)
MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop)
#define MITK_TEST(TESTMETHOD)
Adds a test to the current test suite.
Test fixture for parameterized tests.
ValueType GetValue() const
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeJSONToTemporoSpatialStringProperty(const std::string &value)
Property for time and space resolved string values.