25 std::cout <<
"Loading file: ";
28 std::cout <<
"no file specified [FAILED]" << std::endl;
39 std::cout <<
"file not an image - test will not be applied [PASSED]" << std::endl;
40 std::cout <<
"[TEST DONE]" << std::endl;
43 catch (itk::ExceptionObject &ex)
45 std::cout <<
"Exception: " << ex <<
"[FAILED]" << std::endl;
49 if (image->GetDimension(2) < 2)
54 slice->SetInput(image);
55 slice->SetSliceNr(slice_nr);
58 std::cout <<
"Testing IsInitialized(): ";
59 if (slice->GetOutput()->IsInitialized() ==
false)
61 std::cout <<
"[FAILED]" << std::endl;
64 std::cout <<
"[PASSED]" << std::endl;
66 std::cout <<
"Testing IsSliceSet(): ";
67 if (slice->GetOutput()->IsSliceSet(0) ==
false)
69 std::cout <<
"[FAILED]" << std::endl;
72 std::cout <<
"[PASSED]" << std::endl;
145 slice->UpdateLargestPossibleRegion();
147 catch (itk::ExceptionObject)
149 std::cout <<
"Part 2 [FAILED]" << std::endl;
152 std::cout <<
"Part 2 [PASSED]" << std::endl;
154 std::cout <<
"Testing IsInitialized(): ";
155 if (slice->GetOutput()->IsInitialized() ==
false)
157 std::cout <<
"[FAILED]" << std::endl;
160 std::cout <<
"[PASSED]" << std::endl;
162 std::cout <<
"Testing IsSliceSet(): ";
163 if (slice->GetOutput()->IsSliceSet(0) ==
false)
165 std::cout <<
"[FAILED]" << std::endl;
168 std::cout <<
"[PASSED]" << std::endl;
170 if (image->GetDimension(3) > 1)
172 int time = image->GetDimension(3) - 1;
174 std::cout <<
"Testing 3D+t: Setting time to " << time <<
": ";
175 slice->SetTimeNr(time);
176 if (slice->GetTimeNr() != time)
178 std::cout <<
"[FAILED]" << std::endl;
181 std::cout <<
"[PASSED]" << std::endl;
183 std::cout <<
"Testing 3D+t: Updating slice: ";
185 if (slice->GetOutput()->IsInitialized() ==
false)
187 std::cout <<
"[FAILED]" << std::endl;
190 std::cout <<
"[PASSED]" << std::endl;
192 std::cout <<
"Testing 3D+t: IsSliceSet(): ";
193 if (slice->GetOutput()->IsSliceSet(0) ==
false)
195 std::cout <<
"[FAILED]" << std::endl;
198 std::cout <<
"[PASSED]" << std::endl;
200 std::cout <<
"Testing 3D+t: First slice in reader available: ";
201 if (image->IsSliceSet(0, time) ==
false)
203 std::cout <<
"[FAILED]" << std::endl;
206 std::cout <<
"[PASSED]" << std::endl;
209 std::cout <<
"[TEST DONE]" << std::endl;
int mitkImageSliceSelectorTest(int argc, char *argv[])
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
static mitk::Image::Pointer LoadImage(const std::string &path)
LoadImage Convenience method to load an arbitrary mitkImage.