ImageAccess.cpp 951 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <core/image/ImageAccess.h>
  2. #include <core/basics/Exception.h>
  3. namespace NICE {
  4. int ImageAccess::getPixelInt(int x, int y, int channel) const {
  5. if (channel != 1) {
  6. fthrow(Exception, "channel must be 1 for single channel images.");
  7. }
  8. return getPixelInt(x, y);
  9. }
  10. double ImageAccess::getPixelFloat(int x, int y, int channel) const {
  11. if (channel != 1) {
  12. fthrow(Exception, "channel must be 1 for single channel images.");
  13. }
  14. return getPixelFloat(x, y);
  15. }
  16. int ImageAccess::channels() const {
  17. return 1;
  18. }
  19. void ImageAccess::setPixelInt(int x, int y, int channel, int pixel) {
  20. if (channel != 1) {
  21. fthrow(Exception, "channel must be 1 for single channel images.");
  22. }
  23. setPixelInt(x, y, pixel);
  24. }
  25. void ImageAccess::setPixelFloat(int x, int y, int channel, double pixel) {
  26. if (channel != 1) {
  27. fthrow(Exception, "channel must be 1 for single channel images.");
  28. }
  29. setPixelFloat(x, y, pixel);
  30. }
  31. } // namespace