1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
27 * @file imageMManager.cxx
28 * @brief This file contains the implementation of the ImageMManager class.
30 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
34 #include "imageModificationManager.h"
36 // ----------------------------------------------------------------------------------
37 ImageMManager::ImageMManager()
40 // ----------------------------------------------------------------------------------
41 ImageMManager::ImageMManager(ImageMManager* manager)
43 printf("EED ImageMManager::ImageMManager Start\n");
44 this->m_RegionStruct = manager->GetModifiedRegion();
45 this->m_ValidRegion = manager->ValidateRegion();
47 if (manager->ValidateRegion()==true) printf("EED ImageMManager::ImageMManager manager->ValidateRegion true \n");
48 if (manager->ValidateRegion()==false) printf("EED ImageMManager::ImageMManager manager->ValidateRegion false \n");
49 printf("EED ImageMManager::ImageMManager End\n");
51 // ----------------------------------------------------------------------------------
52 ImageMManager::~ImageMManager()
56 // ----------------------------------------------------------------------------------
57 void ImageMManager::CleanModifiedRegion()
59 int min = std::numeric_limits<int>::min();
60 int max = std::numeric_limits<int>::max();
61 this->m_RegionStruct.minX = max;
62 this->m_RegionStruct.maxX = min;
63 this->m_RegionStruct.minY = max;
64 this->m_RegionStruct.maxY = min;
65 this->m_RegionStruct.minZ = max;
66 this->m_RegionStruct.maxZ = min;
67 this->m_ValidRegion = false;
70 // ----------------------------------------------------------------------------------
71 void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int& k)
73 if (i >= 0 && j >= 0 && k >= 0)
75 if (i <= this->m_RegionStruct.minX) { this->m_RegionStruct.minX = i; } //fi
76 if (i > this->m_RegionStruct.maxX) { this->m_RegionStruct.maxX = i; } //esle
77 if (j <= this->m_RegionStruct.minY) { this->m_RegionStruct.minY = j; } //fi
78 if (j > this->m_RegionStruct.maxY) { this->m_RegionStruct.maxY = j; } //esle
79 if (k <= this->m_RegionStruct.minZ) { this->m_RegionStruct.minZ = k; } //fi
80 if (k > this->m_RegionStruct.maxZ) { this->m_RegionStruct.maxZ = k; } //esle
81 this->m_ValidRegion = true;
83 this->m_ValidRegion = false;
86 // if (m_ValidRegion ) printf(" ImageMManager::CalculateMinMaxRegion true \n");
87 // if (!m_ValidRegion ) printf(" ImageMManager::CalculateMinMaxRegion false \n");
90 // ----------------------------------------------------------------------------------
91 void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k)
93 //printf("EED ImageMManager::AddModifiedPixel \n");
94 this->CalculateMinMaxRegion(i, j, k);
96 // ----------------------------------------------------------------------------------
97 bool ImageMManager::ValidateRegion()
99 return (m_ValidRegion);
101 // ----------------------------------------------------------------------------------
102 RegionStructUR ImageMManager::GetModifiedRegion()
104 return (this->m_RegionStruct);
106 // ----------------------------------------------------------------------------------