00001 // This is core/vil1/vil1_image.cxx 00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00003 #pragma implementation 00004 #endif 00005 //: 00006 // \file 00007 // \author fsm 00008 00009 #include "vil1_image.h" 00010 #include <vcl_climits.h> // for CHAR_BIT 00011 #include <vcl_iostream.h> 00012 00013 vcl_ostream& vil1_image::print(vcl_ostream& s) const 00014 { 00015 if (! *this) return s << "[vil1_image: empty]"; 00016 00017 s << "[vil1_image: size " << width() << " x " << height(); 00018 char const *fmt = file_format(); 00019 s << ", file format " << (fmt ? fmt : "unknown") 00020 << ", components " << components() 00021 << ", bits per component " << bits_per_component(); 00022 #if 1 00023 s << ", format " << vil1_print(component_format()); 00024 #else 00025 s << ", format "; switch (component_format()) { 00026 case VIL1_COMPONENT_FORMAT_UNSIGNED_INT: s << "unsigned"; break; 00027 case VIL1_COMPONENT_FORMAT_SIGNED_INT: s << "signed"; break; 00028 case VIL1_COMPONENT_FORMAT_IEEE_FLOAT: s<< "float"; break; 00029 case VIL1_COMPONENT_FORMAT_COMPLEX: s << "complex"; break; 00030 case VIL1_COMPONENT_FORMAT_UNKNOWN: s << "unknown"; break; 00031 default: s << "??"; break; 00032 } 00033 #endif 00034 return s << "]"; 00035 } 00036 00037 int vil1_image::get_size_bytes() const 00038 { 00039 return planes() * height() * ((width() * components() * bits_per_component() + CHAR_BIT-1) / CHAR_BIT); 00040 }
1.5.1