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 # ------------------------------------------------------------------------ */
26 #include "ManualPaintModel.h"
28 ManualPaintModel::ManualPaintModel()
31 _tool = 0; // 0 pencil , 1 fill
32 _brushfilter = new BrushFilter();
33 _fillfilter = new FillFilter();
34 _imageUndoRedo = new ImageUndoRedo();
35 //EED 2020-04-28 BORRAME Change to local variables to use with openmp
36 // _imageUndoRedo_visited = new ImageUndoRedo();
39 //---------------------------------------------------------------------------
40 ManualPaintModel::~ManualPaintModel()
47 //---------------------------------------------------------------------------
48 void ManualPaintModel::SetActive( bool active )
53 //---------------------------------------------------------------------------
54 void ManualPaintModel::PaintImage(int px, int py, int pz)
60 _brushfilter->SetPoint(px, py, pz);
65 _fillfilter->SetPoint(px, py, pz);
71 //---------------------------------------------------------------------------
72 void ManualPaintModel::SetTool(int tool)
77 //---------------------------------------------------------------------------
78 void ManualPaintModel::Set2D3D(int dim2D3D)
80 _brushfilter -> Set2D3D(dim2D3D);
81 _fillfilter -> Set2D3D(dim2D3D);
84 //---------------------------------------------------------------------------
85 void ManualPaintModel::SetImages(vtkImageData *image,vtkImageData *image2)
89 _brushfilter -> SetImages(image,image2);
90 _fillfilter -> SetImages(image,image2);
93 _imageUndoRedo->SetImage(image2);
95 _imageUndoRedo->SetImage(image);
97 //EED 2020-04-28 BORRAME Change to local variables to use with openmp
98 // _imageUndoRedo_visited->SetImage( _fillfilter->GetAuxImageFill() );
100 printf("EED Warning image=NULL in ManualPaintModel::SetImage(image)\n ");
104 //---------------------------------------------------------------------------
105 void ManualPaintModel::SetGrayLevel(double graylevel)
107 _brushfilter->SetGrayLevel(graylevel);
108 _fillfilter->SetGrayLevel(graylevel);
111 //---------------------------------------------------------------------------
112 void ManualPaintModel::SetRangeMin(int min)
114 _brushfilter->SetRangeMin(min);
115 _fillfilter->SetRangeMin(min);
118 //---------------------------------------------------------------------------
119 void ManualPaintModel::SetRangeMax(int max)
121 _brushfilter->SetRangeMax(max);
122 _fillfilter->SetRangeMax(max);
125 //---------------------------------------------------------------------------
126 void ManualPaintModel::SetDirection(int direction)
128 _brushfilter->SetDirection(direction);
129 _fillfilter->SetDirection(direction);
132 //---------------------------------------------------------------------------
133 void ManualPaintModel::SetBrushSize(int brushsize)
135 _brushfilter->SetBrushSize(brushsize);
138 //---------------------------------------------------------------------------
139 void ManualPaintModel::SetBrushForm(int brushform)
141 _brushfilter->SetBrushForm(brushform);
144 //---------------------------------------------------------------------------
145 void ManualPaintModel::SetToleranceFill(double tolerancefill)
147 _fillfilter->SetToleranceFill(tolerancefill);
150 //---------------------------------------------------------------------------
151 void ManualPaintModel::SetDistanceFill(int distancefill)
153 _fillfilter->SetDistanceFill(distancefill);
156 //---------------------------------------------------------------------------
157 void ManualPaintModel::GetScalarRange(double * range)
159 _fillfilter->GetScalarRange(range);
162 //---------------------------------------------------------------------------
163 void ManualPaintModel::SetUndoImage()
165 ImageMManager* imMManager = NULL;
168 imMManager = this->_brushfilter->GetImageMManager();
172 imMManager = this->_fillfilter->GetImageMManager();
174 this->_imageUndoRedo -> SetURImages(imMManager);
175 //EED 2020-04-28 BORRAME Change to local variables to use with openmp
176 // this->_imageUndoRedo_visited -> SetURImages(imMManager);
177 this->_brushfilter -> CleanImageMManager();
178 this->_fillfilter -> CleanImageMManager();
180 //---------------------------------------------------------------------------
182 void ManualPaintModel::Undo()
184 this->_imageUndoRedo->Undo();
185 //EED 2020-04-28 BORRAME Change to local variables to use with openmp
186 // this->_imageUndoRedo_visited->Undo();
189 void ManualPaintModel::Redo()
191 this->_imageUndoRedo->Redo();
192 //EED 2020-04-28 BORRAME Change to local variables to use with openmp
193 // this->_imageUndoRedo_visited->Redo();
197 int ManualPaintModel::GetRestorBaseInitialPointX()
199 return this->_imageUndoRedo->GetRestorBaseInitialPointX();
202 int ManualPaintModel::GetRestorBaseInitialPointY()
204 return this->_imageUndoRedo->GetRestorBaseInitialPointY();
207 int ManualPaintModel::GetRestorBaseInitialPointZ()
209 return this->_imageUndoRedo->GetRestorBaseInitialPointZ();