MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessPixels

Method ProcessPixels

Filters/HyperTree/vtkImageDataToHyperTreeGrid.cxx:179–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void vtkImageDataToHyperTreeGrid::ProcessPixels(
180 vtkIntArray* grps, vtkHyperTreeGridNonOrientedCursor* cursor)
181{
182 int nbPixel = grps->GetNumberOfValues();
183 int val = grps->GetTuple1(0);
184 bool raf = false;
185 for (int i = 0; i < nbPixel && !raf; ++i)
186 {
187 if (val != grps->GetTuple1(i))
188 {
189 raf = true;
190 break;
191 }
192 }
193
194 int car = this->NbColors * this->NbColors;
195 unsigned char pas = 256 / this->NbColors;
196
197 this->Color->InsertTuple3(this->GlobalId, pas * (unsigned char)((val % car) % this->NbColors),
198 pas * (unsigned char)((val % car) / this->NbColors), pas * (unsigned char)(val / car));
199
200 this->Depth->InsertTuple1(this->GlobalId, cursor->GetLevel());
201
202 if (val < 0)
203 {
204 this->Mask->InsertTuple1(this->GlobalId, true);
205 }
206 else
207 {
208 this->Mask->InsertTuple1(this->GlobalId, false);
209 }
210
211 cursor->SetGlobalIndexFromLocal(this->GlobalId++);
212 if (raf)
213 {
214 cursor->SubdivideLeaf();
215 int ichild = 0;
216 for (int j = 0; j < 2; ++j)
217 {
218 for (int i = 0; i < 2; ++i, ++ichild)
219 {
220 cursor->ToChild(ichild);
221
222 vtkNew<vtkIntArray> childPix;
223 int nbPxl = sqrt(nbPixel) / 2;
224 childPix->SetNumberOfValues(nbPxl * nbPxl);
225 int id = 0;
226 for (int pj = 0; pj < nbPxl; ++pj)
227 {
228 for (int pi = 0; pi < nbPxl; ++pi, ++id)
229 {
230 int grp = grps->GetTuple1(i * nbPxl + pi + (j * nbPxl + pj) * 2 * nbPxl);
231 childPix->SetValue(id, grp);
232 }
233 }
234 ProcessPixels(childPix, cursor);
235
236 cursor->ToParent();

Callers

nothing calls this directly

Calls 12

GetTuple1Method · 0.80
InsertTuple3Method · 0.80
InsertTuple1Method · 0.80
sqrtFunction · 0.50
GetNumberOfValuesMethod · 0.45
GetLevelMethod · 0.45
SubdivideLeafMethod · 0.45
ToChildMethod · 0.45
SetNumberOfValuesMethod · 0.45
SetValueMethod · 0.45
ToParentMethod · 0.45

Tested by

no test coverage detected