32 std::cout <<
"[Failed] To reset Levelwindow" << std::endl;
38 std::cout <<
"Testing mitk::LevelWindow " << std::endl;
40 std::cout <<
"Testing mitk::LevelWindow constructor with Level and Window ";
42 std::cout <<
"[PASSED]" << std::endl;
44 std::cout <<
"Testing mitk::LevelWindow GetDefaultWindow ";
46 if (!(defaultWindow == 500))
48 std::cout << defaultWindow <<
" [FAILED]" << std::endl;
51 std::cout <<
"[PASSED]" << std::endl;
53 std::cout <<
"Testing mitk::LevelWindow GetDefaultLevel ";
55 if (!(defaultLevel == 256))
57 std::cout <<
"[FAILED]" << std::endl;
60 std::cout <<
"[PASSED]" << std::endl;
62 std::cout <<
"Testing mitk::LevelWindow GetWindow ";
66 std::cout <<
"[FAILED]" << std::endl;
69 std::cout <<
"[PASSED]" << std::endl;
71 std::cout <<
"Testing mitk::LevelWindow GetMin ";
72 if (!(levWin->GetLowerWindowBound() == 6))
74 std::cout <<
"[FAILED]" << std::endl;
77 std::cout <<
"[PASSED]" << std::endl;
79 std::cout <<
"Testing mitk::LevelWindow GetMax ";
80 if (!(levWin->GetUpperWindowBound() == 506))
82 std::cout <<
"[FAILED]" << std::endl;
85 std::cout <<
"[PASSED]" << std::endl;
87 std::cout <<
"Testing mitk::LevelWindow GetLevel ";
91 std::cout <<
"[FAILED]" << std::endl;
94 std::cout <<
"[PASSED]" << std::endl;
96 std::cout <<
"Testing mitk::LevelWindow GetWindow : GetDefaultWindow ";
97 if (!(defaultWindow == window))
99 std::cout <<
"[FAILED]" << std::endl;
102 std::cout <<
"[PASSED]" << std::endl;
104 std::cout <<
"Testing mitk::LevelWindow GetLevel : GetDefaultLevel ";
105 if (!(defaultLevel == level))
107 std::cout <<
"[FAILED]" << std::endl;
110 std::cout <<
"[PASSED]" << std::endl;
112 std::cout <<
"Testing mitk::LevelWindow SetLevelWindow ";
113 levWin->SetLevelWindow(20, 100);
114 if (!(levWin->GetLevel() == 20))
116 std::cout <<
"[FAILED]" << std::endl;
119 if (!(levWin->GetWindow() == 100))
121 std::cout <<
"[FAILED]" << std::endl;
124 std::cout <<
"[PASSED]" << std::endl;
126 std::cout <<
"Testing mitk::LevelWindow SetLevelWindow ";
127 levWin->SetLevelWindow(levWin->GetDefaultLevel(), levWin->GetDefaultWindow());
128 if (!(levWin->GetLevel() == 256) && !(levWin->GetWindow() == 500))
130 std::cout <<
"[FAILED]" << std::endl;
133 std::cout <<
"[PASSED]" << std::endl;
135 std::cout <<
"Testing mitk::LevelWindow SetDefaultLevelWindow ";
136 levWin->SetDefaultLevelWindow(20, 200);
137 if (!(levWin->GetDefaultLevel() == 20) && !(levWin->GetDefaultWindow() == 200))
139 std::cout <<
"[FAILED]" << std::endl;
142 std::cout <<
"[PASSED]" << std::endl;
144 std::cout <<
"Testing mitk::LevelWindow ResetDefaultLevelWindow ";
145 levWin->SetLevelWindow(100, 50);
146 levWin->ResetDefaultLevelWindow();
150 if (!((levWin->GetLevel() == 20) && (levWin->GetWindow() == 200)))
152 std::cout <<
"[FAILED]" << std::endl;
155 std::cout <<
"[PASSED]" << std::endl;
157 std::cout <<
"Testing mitk::LevelWindow SetWindowBounds ";
158 levWin->SetWindowBounds(0, 2);
159 if (!((levWin->GetLowerWindowBound() == 0) && (levWin->GetUpperWindowBound() == 2) && (levWin->GetLevel() == 1) &&
160 (levWin->GetWindow() == 2)))
162 std::cout <<
"[FAILED]" << std::endl;
165 levWin->ResetDefaultLevelWindow();
166 std::cout <<
"[PASSED]" << std::endl;
168 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with rangemin = rangemax";
169 levWin->SetRangeMinMax(2000, 2000);
170 if (!(levWin->GetRangeMin() == 1999 && levWin->GetRangeMax() == 2000))
172 std::cout <<
"[FAILED]" << std::endl;
175 std::cout <<
"[PASSED]" << std::endl;
177 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with rangemin > rangemax";
178 levWin->SetRangeMinMax(2100, 2000);
179 if (!(levWin->GetRangeMin() == 2000 && levWin->GetRangeMax() == 2100))
181 std::cout <<
"[FAILED]" << std::endl;
184 std::cout <<
"[PASSED]" << std::endl;
186 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax ";
187 levWin->SetRangeMinMax(-1000, 2000);
188 std::cout <<
"[PASSED]" << std::endl;
190 std::cout <<
"Testing mitk::LevelWindow GetRangeMin ";
191 if (!(levWin->GetRangeMin() == -1000))
193 std::cout <<
"[FAILED]" << std::endl;
196 std::cout <<
"[PASSED]" << std::endl;
198 std::cout <<
"Testing mitk::LevelWindow GetRangeMax ";
199 if (!(levWin->GetRangeMax() == 2000))
201 std::cout <<
"[FAILED]" << std::endl;
204 std::cout <<
"[PASSED]" << std::endl;
206 std::cout <<
"Testing mitk::LevelWindow GetRange ";
207 if (!((levWin->GetRangeMax() - levWin->GetRangeMin()) == levWin->GetRange()))
209 std::cout <<
"[FAILED]" << std::endl;
212 std::cout <<
"[PASSED]" << std::endl;
214 std::cout <<
"Testing mitk::LevelWindow SetDefaultBoundaries with rangemin = rangemax";
215 levWin->SetDefaultBoundaries(2000, 2000);
216 if (!(levWin->GetDefaultLowerBound() == 1999 && levWin->GetDefaultUpperBound() == 2000))
218 std::cout <<
"[FAILED]" << std::endl;
221 std::cout <<
"[PASSED]" << std::endl;
223 std::cout <<
"Testing mitk::LevelWindow SetDefaultBoundaries with rangemin > rangemax";
224 levWin->SetDefaultBoundaries(2100, 2000);
225 if (!(levWin->GetDefaultLowerBound() == 2000 && levWin->GetDefaultUpperBound() == 2100))
227 std::cout <<
"[FAILED]" << std::endl;
230 std::cout <<
"[PASSED]" << std::endl;
232 std::cout <<
"Testing mitk::LevelWindow SetDefaultBoundaries ";
233 levWin->SetDefaultBoundaries(-2000, 8000);
234 std::cout <<
"[PASSED]" << std::endl;
236 std::cout <<
"Testing mitk::LevelWindow GetDefaultLowerBound ";
237 if (!(levWin->GetDefaultLowerBound() == -2000))
239 std::cout <<
"[FAILED]" << std::endl;
242 std::cout <<
"[PASSED]" << std::endl;
244 std::cout <<
"Testing mitk::LevelWindow GetDefaultUpperBound ";
245 if (!(levWin->GetDefaultUpperBound() == 8000))
247 std::cout <<
"[FAILED]" << std::endl;
250 std::cout <<
"[PASSED]" << std::endl;
252 std::cout <<
"Testing mitk::LevelWindow ResetDefaultRangeMinMax ";
253 levWin->ResetDefaultRangeMinMax();
254 if (!((levWin->GetRangeMin() == levWin->GetDefaultLowerBound()) &&
255 (levWin->GetRangeMax() == levWin->GetDefaultUpperBound())))
257 std::cout <<
"[FAILED]" << std::endl;
260 std::cout <<
"[PASSED]" << std::endl;
262 std::cout <<
"Testing mitk::LevelWindow minRange > maxRange ";
263 levWin->SetRangeMinMax(2000, 1000);
264 if (!((levWin->GetRangeMin() == 1000) && (levWin->GetRangeMax() == 2000)))
266 std::cout <<
"[FAILED]" << std::endl;
269 levWin->SetRangeMinMax(2000, -1000);
270 if (!((levWin->GetRangeMin() == -1000) && (levWin->GetRangeMax() == 2000)))
272 std::cout <<
"[FAILED]" << std::endl;
275 levWin->SetRangeMinMax(-2000, -3000);
276 if (!((levWin->GetRangeMin() == -3000) && (levWin->GetRangeMax() == -2000)))
278 std::cout <<
"[FAILED]" << std::endl;
281 levWin->SetRangeMinMax(0, -1000);
282 if (!((levWin->GetRangeMin() == -1000) && (levWin->GetRangeMax() == 0)))
284 std::cout <<
"[FAILED]" << std::endl;
287 levWin->SetRangeMinMax(2000, 0);
288 if (!((levWin->GetRangeMin() == 0) && (levWin->GetRangeMax() == 2000)))
290 std::cout <<
"[FAILED]" << std::endl;
293 levWin->SetRangeMinMax(-10000, 10000);
294 std::cout <<
"[PASSED]" << std::endl;
296 std::cout <<
"Testing mitk::LevelWindow defaultMinRange > defaultMaxRange ";
297 levWin->SetDefaultBoundaries(2000, 1000);
298 if (!((levWin->GetDefaultLowerBound() == 1000) && (levWin->GetDefaultUpperBound() == 2000)))
300 std::cout <<
"[FAILED]" << std::endl;
303 levWin->SetDefaultBoundaries(2000, -1000);
304 if (!((levWin->GetDefaultLowerBound() == -1000) && (levWin->GetDefaultUpperBound() == 2000)))
306 std::cout <<
"[FAILED]" << std::endl;
309 levWin->SetDefaultBoundaries(-2000, -3000);
310 if (!((levWin->GetDefaultLowerBound() == -3000) && (levWin->GetDefaultUpperBound() == -2000)))
312 std::cout <<
"[FAILED]" << std::endl;
315 levWin->SetDefaultBoundaries(0, -1000);
316 if (!((levWin->GetDefaultLowerBound() == -1000) && (levWin->GetDefaultUpperBound() == 0)))
318 std::cout <<
"[FAILED]" << std::endl;
321 levWin->SetDefaultBoundaries(2000, 0);
322 if (!((levWin->GetDefaultLowerBound() == 0) && (levWin->GetDefaultUpperBound() == 2000)))
324 std::cout <<
"[FAILED]" << std::endl;
327 levWin->SetDefaultBoundaries(-10000, 10000);
328 std::cout <<
"[PASSED]" << std::endl;
330 std::cout <<
"Testing mitk::LevelWindow min > max ";
331 levWin->SetWindowBounds(2000, 1000);
332 if (!((levWin->GetLowerWindowBound() == 1000) && (levWin->GetUpperWindowBound() == 2000)))
334 std::cout <<
"[FAILED]" << std::endl;
337 levWin->SetWindowBounds(2000, -1000);
338 if (!((levWin->GetLowerWindowBound() == -1000) && (levWin->GetUpperWindowBound() == 2000)))
340 std::cout <<
"[FAILED]" << std::endl;
343 levWin->SetWindowBounds(-2000, -3000);
344 if (!((levWin->GetLowerWindowBound() == -3000) && (levWin->GetUpperWindowBound() == -2000)))
346 std::cout <<
"[FAILED]" << std::endl;
349 levWin->SetWindowBounds(0, -1000);
350 if (!((levWin->GetLowerWindowBound() == -1000) && (levWin->GetUpperWindowBound() == 0)))
352 std::cout <<
"[FAILED]" << std::endl;
355 levWin->SetWindowBounds(2000, 0);
356 if (!((levWin->GetLowerWindowBound() == 0) && (levWin->GetUpperWindowBound() == 2000)))
358 std::cout <<
"[FAILED]" << std::endl;
361 levWin->ResetDefaultLevelWindow();
362 std::cout <<
"[PASSED]" << std::endl;
367 std::cout <<
"Testing mitk::LevelWindow max > min > maxrange autoexpand = FALSE";
368 levWin->SetWindowBounds(11000, 12000,
false);
369 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 10000)))
371 std::cout <<
"[FAILED]" << levWin->GetLowerWindowBound() <<
"," << levWin->GetUpperWindowBound() << std::endl;
374 levWin->ResetDefaultLevelWindow();
375 std::cout <<
"[PASSED]" << std::endl;
377 std::cout <<
"Testing mitk::LevelWindow max > min > maxrange autoexpand = TRUE";
378 levWin->SetWindowBounds(11000, 12000);
379 if (!((levWin->GetLowerWindowBound() == 11000) && (levWin->GetUpperWindowBound() == 12000)))
381 std::cout <<
"[FAILED]" << levWin->GetLowerWindowBound() <<
"," << levWin->GetUpperWindowBound() << std::endl;
384 levWin->ResetDefaultLevelWindow();
385 std::cout <<
"[PASSED]" << std::endl;
390 std::cout <<
"Testing mitk::LevelWindow min > max > maxrange autoexpand = FALSE";
391 levWin->SetWindowBounds(12000, 11000,
false);
392 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 10000)))
394 std::cout <<
"[FAILED]" << std::endl;
397 levWin->ResetDefaultLevelWindow();
398 std::cout <<
"[PASSED]" << std::endl;
400 std::cout <<
"Testing mitk::LevelWindow min > max > maxrange autoexpand = TRUE";
401 levWin->SetWindowBounds(12000, 11000);
402 if (!((levWin->GetLowerWindowBound() == 11000) && (levWin->GetUpperWindowBound() == 12000)))
404 std::cout <<
"[FAILED]" << std::endl;
407 levWin->ResetDefaultLevelWindow();
408 std::cout <<
"[PASSED]" << std::endl;
412 std::cout <<
"Testing mitk::LevelWindow min < max < minrange autoexpand = FALSE";
413 levWin->SetWindowBounds(-12000, -11000,
false);
414 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9999)))
416 std::cout <<
"[FAILED]" << std::endl;
419 levWin->ResetDefaultLevelWindow();
420 std::cout <<
"[PASSED]" << std::endl;
422 std::cout <<
"Testing mitk::LevelWindow min < max < minrange autoexpand = TRUE";
423 levWin->SetWindowBounds(-12000, -11000);
424 if (!((levWin->GetLowerWindowBound() == -12000) && (levWin->GetUpperWindowBound() == -11000)))
426 std::cout <<
"[FAILED]" << std::endl;
429 levWin->ResetDefaultLevelWindow();
430 std::cout <<
"[PASSED]" << std::endl;
434 std::cout <<
"Testing mitk::LevelWindow max < min < minrange autoexpand = FALSE";
435 levWin->SetWindowBounds(-11000, -12000,
false);
436 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9999)))
438 std::cout <<
"[FAILED]: Expected (-10000, -9999): " << levWin->GetLowerWindowBound() <<
" - "
439 << levWin->GetUpperWindowBound() << std::endl;
442 levWin->ResetDefaultLevelWindow();
443 std::cout <<
"[PASSED]" << std::endl;
445 std::cout <<
"Testing mitk::LevelWindow max < min < minrange autoexpand = TRUE";
446 levWin->SetWindowBounds(-11000, -12000);
447 if (!((levWin->GetLowerWindowBound() == -12000) && (levWin->GetUpperWindowBound() == -11000)))
449 std::cout <<
"[FAILED]" << std::endl;
452 levWin->ResetDefaultLevelWindow();
453 std::cout <<
"[PASSED]" << std::endl;
457 std::cout <<
"Testing mitk::LevelWindow min < maxrang & max > maxrange autoexpand = FALSE";
458 levWin->SetWindowBounds(9999, 12000,
false);
459 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 10000)))
461 std::cout <<
"[FAILED]" << std::endl;
464 levWin->ResetDefaultLevelWindow();
465 std::cout <<
"[PASSED]" << std::endl;
467 std::cout <<
"Testing mitk::LevelWindow min < maxrang & max > maxrange autoexpand = TRUE";
468 levWin->SetWindowBounds(9999, 12000);
469 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 12000)))
471 std::cout <<
"[FAILED]" << std::endl;
474 levWin->ResetDefaultLevelWindow();
475 std::cout <<
"[PASSED]" << std::endl;
479 std::cout <<
"Testing mitk::LevelWindow min < minrange & max > minrange autoexpand = FALSE";
480 levWin->SetWindowBounds(-11000, -9999,
false);
481 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9999)))
483 std::cout <<
"[FAILED]" << std::endl;
486 levWin->ResetDefaultLevelWindow();
487 std::cout <<
"[PASSED]" << std::endl;
489 std::cout <<
"Testing mitk::LevelWindow min < minrange & max > minrange autoexpand = TRUE";
490 levWin->SetWindowBounds(-11000, -9999);
491 if (!((levWin->GetLowerWindowBound() == -11000) && (levWin->GetUpperWindowBound() == -9999)))
493 std::cout <<
"[FAILED]" << std::endl;
496 levWin->ResetDefaultLevelWindow();
497 std::cout <<
"[PASSED]" << std::endl;
501 std::cout <<
"Testing mitk::LevelWindow min < minrange & max > maxrange autoexpand = FALSE";
502 levWin->SetWindowBounds(-11000, 11000,
false);
503 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == 10000)))
505 std::cout <<
"[FAILED]" << std::endl;
508 levWin->ResetDefaultLevelWindow();
509 std::cout <<
"[PASSED]" << std::endl;
511 std::cout <<
"Testing mitk::LevelWindow min < minrange & max > maxrange autoexpand = TRUE";
512 levWin->SetWindowBounds(-11000, 11000);
513 if (!((levWin->GetLowerWindowBound() == -11000) && (levWin->GetUpperWindowBound() == 11000)))
515 std::cout <<
"[FAILED]" << std::endl;
518 levWin->ResetDefaultLevelWindow();
519 std::cout <<
"[PASSED]" << std::endl;
523 std::cout <<
"Testing mitk::LevelWindow maxrange > min = max > minrange autoexpand = FALSE";
524 levWin->SetWindowBounds(5000, 5000,
false);
525 if (!((levWin->GetLowerWindowBound() == 4999.5) && (levWin->GetUpperWindowBound() == 5000.5)))
527 std::cout <<
"[FAILED]: Expected (4999.5, 5000.5): " << levWin->GetLowerWindowBound() <<
" - "
528 << levWin->GetUpperWindowBound() << std::endl;
531 levWin->ResetDefaultLevelWindow();
532 std::cout <<
"[PASSED]" << std::endl;
534 std::cout <<
"Testing mitk::LevelWindow maxrange > min = max > minrange autoexpand = TRUE";
535 levWin->SetWindowBounds(5000, 5000);
536 if (!((levWin->GetLowerWindowBound() == 4999.5) && (levWin->GetUpperWindowBound() == 5000.5)))
538 std::cout <<
"[FAILED]" << std::endl;
541 levWin->ResetDefaultLevelWindow();
542 std::cout <<
"[PASSED]" << std::endl;
546 std::cout <<
"Testing mitk::LevelWindow min = max = minrange autoexpand = FALSE";
547 levWin->SetWindowBounds(-10000, -10000,
false);
548 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9999)))
550 std::cout <<
"[FAILED]: Expected (-10000, -9999): " << levWin->GetLowerWindowBound() <<
" - "
551 << levWin->GetUpperWindowBound() <<
" . " << levWin->GetRangeMin() << std::endl;
554 levWin->ResetDefaultLevelWindow();
555 std::cout <<
"[PASSED]" << std::endl;
557 std::cout <<
"Testing mitk::LevelWindow min = max = minrange autoexpand = TRUE";
558 levWin->SetWindowBounds(-10000, -10000);
559 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9999)))
561 std::cout <<
"[FAILED]" << std::endl;
564 levWin->ResetDefaultLevelWindow();
565 std::cout <<
"[PASSED]" << std::endl;
569 std::cout <<
"Testing mitk::LevelWindow min = max = maxrange autoexpand = FALSE";
570 levWin->SetWindowBounds(10000, 10000,
false);
571 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 10000)))
573 std::cout <<
"[FAILED]" << std::endl;
576 levWin->ResetDefaultLevelWindow();
577 std::cout <<
"[PASSED]" << std::endl;
579 std::cout <<
"Testing mitk::LevelWindow min = max = maxrange autoexpand = TRUE";
580 levWin->SetWindowBounds(10000, 10000);
581 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 10000)))
583 std::cout <<
"[FAILED]" << std::endl;
586 levWin->ResetDefaultLevelWindow();
587 std::cout <<
"[PASSED]" << std::endl;
591 std::cout <<
"Testing mitk::LevelWindow min = max > maxrange autoexpand = FALSE";
592 levWin->SetWindowBounds(11000, 11000,
false);
593 if (!((levWin->GetLowerWindowBound() == 9999) && (levWin->GetUpperWindowBound() == 10000)))
595 std::cout <<
"[FAILED]" << std::endl;
598 levWin->ResetDefaultLevelWindow();
599 std::cout <<
"[PASSED]" << std::endl;
601 std::cout <<
"Testing mitk::LevelWindow min = max > maxrange autoexpand = TRUE";
602 levWin->SetWindowBounds(11000, 11000);
603 if (!((levWin->GetLowerWindowBound() == 10999) && (levWin->GetUpperWindowBound() == 11000)))
605 std::cout <<
"[FAILED]" << std::endl;
608 levWin->ResetDefaultLevelWindow();
609 std::cout <<
"[PASSED]" << std::endl;
613 std::cout <<
"Testing mitk::LevelWindow min = max < minrange autoexpand = FALSE";
614 levWin->SetWindowBounds(-11000, -11000,
false);
615 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9999)))
617 std::cout <<
"[FAILED]" << std::endl;
620 levWin->ResetDefaultLevelWindow();
621 std::cout <<
"[PASSED]" << std::endl;
623 std::cout <<
"Testing mitk::LevelWindow min = max < minrange autoexpand = TRUE";
624 levWin->SetWindowBounds(-11000, -11000);
625 if (!((levWin->GetLowerWindowBound() == -11000) && (levWin->GetUpperWindowBound() == -10999)))
627 std::cout <<
"[FAILED]" << std::endl;
630 levWin->ResetDefaultLevelWindow();
631 std::cout <<
"[PASSED]" << std::endl;
635 std::cout <<
"Testing mitk::LevelWindow maxrange > min > minrange > max autoexpand = FALSE";
636 levWin->SetWindowBounds(-9000, -11000,
false);
637 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == -9000)))
639 std::cout <<
"[FAILED]" << std::endl;
642 levWin->ResetDefaultLevelWindow();
643 std::cout <<
"[PASSED]" << std::endl;
645 std::cout <<
"Testing mitk::LevelWindow maxrange > min > minrange > max autoexpand = TRUE";
646 levWin->SetWindowBounds(-9000, -11000,
true);
647 if (!((levWin->GetLowerWindowBound() == -11000) && (levWin->GetUpperWindowBound() == -9000)))
649 std::cout <<
"[FAILED]" << std::endl;
652 levWin->ResetDefaultLevelWindow();
653 std::cout <<
"[PASSED]" << std::endl;
657 std::cout <<
"Testing mitk::LevelWindow min > maxrange > minrange > max autoexpand = FALSE";
658 levWin->SetWindowBounds(11000, -11000,
false);
659 if (!((levWin->GetLowerWindowBound() == -10000) && (levWin->GetUpperWindowBound() == 10000)))
661 std::cout <<
"[FAILED]" << std::endl;
664 levWin->ResetDefaultLevelWindow();
665 std::cout <<
"[PASSED]" << std::endl;
667 std::cout <<
"Testing mitk::LevelWindow min > maxrange > minrange > max autoexpand = TRUE";
668 levWin->SetWindowBounds(11000, -11000);
669 if (!((levWin->GetLowerWindowBound() == -11000) && (levWin->GetUpperWindowBound() == 11000)))
671 std::cout <<
"[FAILED]" << std::endl;
674 levWin->ResetDefaultLevelWindow();
675 std::cout <<
"[PASSED]" << std::endl;
679 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with maxrange < min < max autoexpand = FALSE";
680 levWin->SetRangeMinMax(-20000, -15000);
681 if (!((levWin->GetLowerWindowBound() == -15001) && (levWin->GetUpperWindowBound() == -15000)))
683 std::cout <<
"[FAILED]" << std::endl;
686 levWin->ResetDefaultRangeMinMax();
687 levWin->ResetDefaultLevelWindow();
688 std::cout <<
"[PASSED]" << std::endl;
690 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with minrange > maxrange & maxrange < min < max ";
691 levWin->ResetDefaultLevelWindow();
692 levWin->SetRangeMinMax(-15000, -20000);
693 if (!((levWin->GetLowerWindowBound() == -15001) && (levWin->GetUpperWindowBound() == -15000)))
695 std::cout <<
"[FAILED]" << std::endl;
698 levWin->ResetDefaultRangeMinMax();
699 levWin->ResetDefaultLevelWindow();
700 std::cout <<
"[PASSED]" << std::endl;
702 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with minrange < min < maxrange < max autoexpand = FALSE";
703 levWin->SetRangeMinMax(-80, 1000);
704 levWin->SetWindowBounds(-1000, 110,
false);
705 if (!((levWin->GetLowerWindowBound() == -80) && (levWin->GetUpperWindowBound() == 110)))
707 std::cout <<
"[FAILED]" << std::endl;
710 levWin->ResetDefaultRangeMinMax();
711 levWin->ResetDefaultLevelWindow();
712 std::cout <<
"[PASSED]" << std::endl;
714 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with minrange < min < maxrange < max autoexpand = TRUE";
715 levWin->SetRangeMinMax(-80, 1000);
716 levWin->SetWindowBounds(-1000, 110);
717 if (!((levWin->GetLowerWindowBound() == -1000) && (levWin->GetUpperWindowBound() == 110)))
719 std::cout <<
"[FAILED]" << std::endl;
722 levWin->ResetDefaultRangeMinMax();
723 levWin->ResetDefaultLevelWindow();
724 std::cout <<
"[PASSED]" << std::endl;
728 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with maxrange < minrange & minrange < min < maxrange < max "
729 "autoexpand = FALSE";
730 levWin->SetRangeMinMax(1000, -80);
731 levWin->SetWindowBounds(-1000, 110,
false);
732 if (!((levWin->GetLowerWindowBound() == -80) && (levWin->GetUpperWindowBound() == 110)))
734 std::cout <<
"[FAILED]" << std::endl;
737 levWin->ResetDefaultRangeMinMax();
738 levWin->ResetDefaultLevelWindow();
739 std::cout <<
"[PASSED]" << std::endl;
741 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with maxrange < minrange & minrange < min < maxrange < max "
743 levWin->SetRangeMinMax(1000, -80);
744 levWin->SetWindowBounds(-1000, 110);
745 if (!((levWin->GetLowerWindowBound() == -1000) && (levWin->GetUpperWindowBound() == 110)))
747 std::cout <<
"[FAILED]" << std::endl;
750 levWin->ResetDefaultRangeMinMax();
751 levWin->ResetDefaultLevelWindow();
752 std::cout <<
"[PASSED]" << std::endl;
756 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with min < minrange < maxrange <max ";
757 levWin->SetRangeMinMax(20, 110);
758 if (!((levWin->GetLowerWindowBound() == 20) && (levWin->GetUpperWindowBound() == 110)))
760 std::cout <<
"[FAILED]" << std::endl;
763 levWin->ResetDefaultRangeMinMax();
764 levWin->ResetDefaultLevelWindow();
765 std::cout <<
"[PASSED]" << std::endl;
767 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with minRange > maxRange & min < maxrange < max ";
768 levWin->SetWindowBounds(-90, 1000);
769 levWin->SetRangeMinMax(100, -80);
771 if (!((levWin->GetLowerWindowBound() == -80) && (levWin->GetUpperWindowBound() == 100)))
773 std::cout <<
"[FAILED]" << std::endl;
776 levWin->ResetDefaultRangeMinMax();
777 levWin->ResetDefaultLevelWindow();
778 std::cout <<
"[PASSED]" << std::endl;
780 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with minRange > maxRange & min < minrange < maxrange <max ";
781 levWin->SetRangeMinMax(20, 100);
782 if (!((levWin->GetLowerWindowBound() == 20) && (levWin->GetUpperWindowBound() == 100)))
784 std::cout <<
"[FAILED]" << std::endl;
787 levWin->ResetDefaultRangeMinMax();
788 levWin->ResetDefaultLevelWindow();
789 std::cout <<
"[PASSED]" << std::endl;
791 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with min < max < minrange ";
792 levWin->SetRangeMinMax(20000, 15000);
793 if (!((levWin->GetLowerWindowBound() == 15000) && (levWin->GetUpperWindowBound() == 15001)))
795 std::cout <<
"[FAILED]" << std::endl;
798 levWin->ResetDefaultRangeMinMax();
799 levWin->ResetDefaultLevelWindow();
800 std::cout <<
"[PASSED]" << std::endl;
802 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with minrange > maxrange & min < max < minrange ";
803 levWin->SetRangeMinMax(20000, 15000);
804 if (!((levWin->GetLowerWindowBound() == 15000) && (levWin->GetUpperWindowBound() == 15001)))
806 std::cout <<
"[FAILED]" << std::endl;
809 levWin->ResetDefaultRangeMinMax();
810 levWin->ResetDefaultLevelWindow();
811 std::cout <<
"[PASSED]" << std::endl;
813 std::cout <<
"Testing mitk::LevelWindow SetRangeMinMax with min < minrange <max ";
814 levWin->SetRangeMinMax(-20000, -15000);
815 if (!((levWin->GetLowerWindowBound() == -15001) && (levWin->GetUpperWindowBound() == -15000)))
817 std::cout <<
"[FAILED]" << std::endl;
820 levWin->ResetDefaultRangeMinMax();
821 levWin->ResetDefaultLevelWindow();
822 std::cout <<
"[PASSED]" << std::endl;
829 unsigned int dim[] = {100, 100, 20};
831 std::cout <<
"Creating image: ";
835 image->Initialize(mitk::MakePixelType<int, int, 1>(), 3, dim);
837 int *p = (
int *)imAccess.
GetData();
839 int size = dim[0] * dim[1] * dim[2];
841 for (i = 0; i < size; ++i, ++p)
843 std::cout <<
"[PASSED]" << std::endl;
845 std::cout <<
"Testing mitk::LevelWindow SetAuto ";
848 std::cout <<
"[PASSED]" << std::endl;
850 std::cout <<
"Testing mitk::LevelWindow constructor with mitkLevelWindow ";
854 std::cout <<
"[FAILED]" << std::endl;
858 std::cout <<
"[PASSED]" << std::endl;
860 std::cout <<
"Testing mitk::LevelWindow destructor ";
864 std::cout <<
"[PASSED]" << std::endl;
869 std::cout <<
"Testing range restriction of mitk::LevelWindow::SetWindowBounds() autoexpand = FALSE";
875 std::cout <<
"[FAILED]" << std::endl;
878 std::cout <<
"[PASSED]" << std::endl;
880 std::cout <<
"Testing range restriction of mitk::LevelWindow::SetWindowBounds() autoexpand = TRUE";
884 std::cout <<
"[FAILED]" << std::endl;
887 std::cout <<
"[PASSED]" << std::endl;
892 std::cout <<
"Testing range restriction of mitk::LevelWindow::SetLevelWindow() autoexpand = FALSE";
896 std::cout <<
"[FAILED]" << std::endl;
899 std::cout <<
"[PASSED]" << std::endl;
901 std::cout <<
"Testing range restriction of mitk::LevelWindow::SetLevelWindow() autoexpand = TRUE";
905 std::cout <<
"[FAILED]" << std::endl;
908 std::cout <<
"[PASSED]" << std::endl;
913 std::cout <<
"Testing range restriction of mitk::LevelWindow::SetLevelWindow() autoexpand = FALSE";
917 std::cout <<
"[FAILED]" << std::endl;
920 std::cout <<
"[PASSED]" << std::endl;
922 std::cout <<
"Testing range restriction of mitk::LevelWindow::SetLevelWindow() autoexpand = TRUE";
926 std::cout <<
"[FAILED]" << std::endl;
929 std::cout <<
"[PASSED]" << std::endl;
931 std::cout <<
"Testing range adaption of mitk::LevelWindow::SetWindowBounds()";
935 std::cout <<
"[FAILED]" << std::endl;
938 std::cout <<
"[PASSED]" << std::endl;
940 std::cout <<
"Testing range adaption of mitk::LevelWindow::SetWindowBounds()";
944 std::cout <<
"[FAILED]" << std::endl;
947 std::cout <<
"[PASSED]" << std::endl;
949 std::cout <<
"Testing range adaption of mitk::LevelWindow::SetLevelWindow()";
953 std::cout <<
"[FAILED]" << std::endl;
956 std::cout <<
"[PASSED]" << std::endl;
958 std::cout <<
"Testing c'tor with x-ray values (formerly did not expand range enough)";
962 std::cout <<
"[FAILED]" << std::endl;
965 std::cout <<
"[PASSED]" << std::endl;
967 std::cout <<
"[PASSED]" << std::endl;
968 std::cout <<
"[TEST DONE]" << std::endl;
void SetWindowBounds(ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary=true)
ScalarType GetLowerWindowBound() const
void * GetData()
Gives full data access.
void SetRangeMinMax(ScalarType min, ScalarType max)
The LevelWindow class Class to store level/window values.
void resetLevelWindow(mitk::LevelWindow &lw)
void SetAuto(const Image *image, bool tryPicTags=true, bool guessByCentralSlice=true, unsigned selectedComponent=0)
sets level/window to optimize the contrast of the given Image
int mitkLevelWindowTest(int, char *[])
ScalarType GetRangeMax() const
ScalarType GetRangeMin() const
ImageWriteAccessor class to get locked write-access for a particular image part.
ScalarType GetUpperWindowBound() const
void SetLevelWindow(ScalarType level, ScalarType window, bool expandRangesIfNecessary=true)
ScalarType GetWindow() const
returns the current window size, i.e the range size of the current grey value interval ...
ScalarType GetRange() const
returns the size of the grey value range
ScalarType GetLevel() const
method that returns the level value, i.e. the center of the current grey value interval ...