00001 #include "ImageToImageOperator8.h" 00002 00003 using namespace puma2; 00004 00005 ImageToImageOperator8::ImageToImageOperator8() 00006 { 00007 } 00008 00009 ImageToImageOperator8::~ImageToImageOperator8() 00010 { 00011 }; 00012 00013 void ImageToImageOperator8::apply(const GrayLevelImage8 & iImg, GrayLevelImage8 & oImg) 00014 { 00015 throw "should be implemented in derived function"; 00016 } 00017 00018 void ImageToImageOperator8::operator() 00019 (const GrayLevelImage8 & iImg, GrayLevelImage8 & oImg) 00020 { 00021 checkSize(iImg,oImg); // virtual - can be overwritten 00022 apply(iImg,oImg); 00023 } 00024 00025 void ImageToImageOperator8::checkSize 00026 (const GrayLevelImage8 & iImg, GrayLevelImage8 & oImg) 00027 { 00028 if (oImg.getWidth() != 0) { 00029 if ((oImg.getWidth() != iImg.getWidth() ) || 00030 (oImg.getHeight() != iImg.getHeight() )) 00031 throw "Image size missmatch"; 00032 } else { 00033 oImg.resize(iImg.getWidth(),iImg.getHeight()); 00034 } 00035 } 00036