IntensityImageStudent::IntensityImageStudent(const IntensityImageStudent &other) : IntensityImage(other.getWidth(), other.getHeight()) { init_intensity_image(); for (int y = 0; y < height; y++){ for (int x = 0; x < width; x++){ intensity_image[x][y] = other.getPixel(x, y); } } }
IntensityImageStudent::IntensityImageStudent(const IntensityImageStudent &other) : IntensityImage(other.getWidth(), other.getHeight()), pixelMap(nullptr) { const int SIZE = other.getSize(); if (SIZE > 0) { pixelMap = new Intensity[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
void IntensityImageStudent::set(const IntensityImageStudent &other) { const int SIZE = other.getSize(); IntensityImage::set(other.getWidth(), other.getHeight()); if (SIZE > 0) { delete[] pixelMap; pixelMap = new Intensity[SIZE]; for (int i = 0; i < SIZE; i++) { pixelMap[i] = other.getPixel(i); } } }
void IntensityImageStudent::set(const IntensityImageStudent &other) { Intensity** t_intensity_array = intensity_image; int old_height = height; width = other.width; height = other.height; init_intensity_image(); for (int y = 0; y < height; y++){ for (int x = 0; x < width; x++){ intensity_image[x][y] = other.getPixel(x, y); } } delete_intensity_array(t_intensity_array, old_height); }