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 _imageUndoRedo_visited = new ImageUndoRedo();
38 //---------------------------------------------------------------------------
39 ManualPaintModel::~ManualPaintModel()
46 //---------------------------------------------------------------------------
47 void ManualPaintModel::SetActive( bool active )
52 //---------------------------------------------------------------------------
53 void ManualPaintModel::PaintImage(int px, int py, int pz)
59 _brushfilter->SetPoint(px, py, pz);
64 _fillfilter->SetPoint(px, py, pz);
70 //---------------------------------------------------------------------------
71 void ManualPaintModel::SetTool(int tool)
76 //---------------------------------------------------------------------------
77 void ManualPaintModel::Set2D3D(int dim2D3D)
79 _brushfilter -> Set2D3D(dim2D3D);
80 _fillfilter -> Set2D3D(dim2D3D);
83 //---------------------------------------------------------------------------
84 void ManualPaintModel::SetImages(vtkImageData *image,vtkImageData *image2)
88 _brushfilter -> SetImages(image,image2);
89 _fillfilter -> SetImages(image,image2);
92 _imageUndoRedo->SetImage(image2);
94 _imageUndoRedo->SetImage(image);
96 _imageUndoRedo_visited->SetImage( _fillfilter->GetAuxImageFill() );
98 printf("EED Warning image=NULL in ManualPaintModel::SetImage(image)\n ");
102 //---------------------------------------------------------------------------
103 void ManualPaintModel::SetGrayLevel(double graylevel)
105 _brushfilter->SetGrayLevel(graylevel);
106 _fillfilter->SetGrayLevel(graylevel);
109 //---------------------------------------------------------------------------
110 void ManualPaintModel::SetRangeMin(int min)
112 _brushfilter->SetRangeMin(min);
113 _fillfilter->SetRangeMin(min);
116 //---------------------------------------------------------------------------
117 void ManualPaintModel::SetRangeMax(int max)
119 _brushfilter->SetRangeMax(max);
120 _fillfilter->SetRangeMax(max);
123 //---------------------------------------------------------------------------
124 void ManualPaintModel::SetDirection(int direction)
126 _brushfilter->SetDirection(direction);
127 _fillfilter->SetDirection(direction);
130 //---------------------------------------------------------------------------
131 void ManualPaintModel::SetBrushSize(int brushsize)
133 _brushfilter->SetBrushSize(brushsize);
136 //---------------------------------------------------------------------------
137 void ManualPaintModel::SetBrushForm(int brushform)
139 _brushfilter->SetBrushForm(brushform);
142 //---------------------------------------------------------------------------
143 void ManualPaintModel::SetToleranceFill(double tolerancefill)
145 _fillfilter->SetToleranceFill(tolerancefill);
148 //---------------------------------------------------------------------------
149 void ManualPaintModel::SetDistanceFill(int distancefill)
151 _fillfilter->SetDistanceFill(distancefill);
154 //---------------------------------------------------------------------------
155 void ManualPaintModel::GetScalarRange(double * range)
157 _fillfilter->GetScalarRange(range);
160 //---------------------------------------------------------------------------
161 void ManualPaintModel::SetUndoImage()
163 ImageMManager* imMManager = NULL;
166 imMManager = this->_brushfilter->GetImageMManager();
170 imMManager = this->_fillfilter->GetImageMManager();
172 this->_imageUndoRedo -> SetURImages(imMManager);
173 this->_imageUndoRedo_visited -> SetURImages(imMManager);
174 this->_brushfilter -> CleanImageMManager();
175 this->_fillfilter -> CleanImageMManager();
177 //---------------------------------------------------------------------------
179 void ManualPaintModel::Undo()
181 this->_imageUndoRedo->Undo();
182 this->_imageUndoRedo_visited->Undo();
185 void ManualPaintModel::Redo()
187 this->_imageUndoRedo->Redo();
188 this->_imageUndoRedo_visited->Redo();
192 int ManualPaintModel::GetRestorBaseInitialPointX()
194 return this->_imageUndoRedo->GetRestorBaseInitialPointX();
197 int ManualPaintModel::GetRestorBaseInitialPointY()
199 return this->_imageUndoRedo->GetRestorBaseInitialPointY();
202 int ManualPaintModel::GetRestorBaseInitialPointZ()
204 return this->_imageUndoRedo->GetRestorBaseInitialPointZ();