172{
173 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
174 vtkInformation *outInfo = outputVector->GetInformationObject(0);
175
176 vtkPolyData *input = vtkPolyData::SafeDownCast(
177 inInfo->Get(vtkDataObject::DATA_OBJECT()));
178 vtkPolyData *output = vtkPolyData::SafeDownCast(
179 outInfo->Get(vtkDataObject::DATA_OBJECT()));
180
182 {
183 vtkErrorMacro(<<"RadiusArrayName not specified");
184 return 1;
185 }
186
187 vtkDataArray* radiusArray = input->GetPointData()->GetArray(this->
RadiusArrayName);
188
189 if (!radiusArray)
190 {
191 vtkErrorMacro(<<"RadiusArray with name specified does not exist");
192 return 1;
193 }
194
196 {
197 vtkErrorMacro(<<"GroupIdsArrayName not specified");
198 return 1;
199 }
200
201 vtkDataArray* groupIdsArray = input->GetCellData()->GetArray(this->
GroupIdsArrayName);
202
203 if (!groupIdsArray)
204 {
205 vtkErrorMacro(<<"GroupIdsArray with name specified does not exist");
206 return 1;
207 }
208
210 {
211 vtkErrorMacro(<<"CenterlineIdsArrayName not specified");
212 return 1;
213 }
214
216
217 if (!centerlineIdsArray)
218 {
219 vtkErrorMacro(<<"CenterlineIdsArray with name specified does not exist");
220 return 1;
221 }
222
224 {
225 vtkErrorMacro(<<"TractIdsArrayName not specified");
226 return 1;
227 }
228
229 vtkDataArray* tractIdsArray = input->GetCellData()->GetArray(this->
TractIdsArrayName);
230
231 if (!tractIdsArray)
232 {
233 vtkErrorMacro(<<"TractIdsArray with name specified does not exist");
234 return 1;
235 }
236
238 {
239 vtkErrorMacro(<<"BlankingArrayName not specified");
240 return 1;
241 }
242
243 vtkDataArray* blankingArray = input->GetCellData()->GetArray(this->
BlankingArrayName);
244
245 if (!blankingArray)
246 {
247 vtkErrorMacro(<<"BlankingArray with name specified does not exist");
248 return 1;
249 }
250
252 {
253 vtkErrorMacro(<<"ReferenceSystemGroupIdsArrayName not specified");
254 return 1;
255 }
256
258
259 if (!referenceSystemGroupIdsArray)
260 {
261 vtkErrorMacro(<<"ReferenceSystemGroupIdsArray with name specified does not exist");
262 return 1;
263 }
264
266 {
267 vtkErrorMacro(<<"ReferenceSystemNormalArrayName not specified");
268 return 1;
269 }
270
272
273 if (!referenceSystemNormalArray)
274 {
275 vtkErrorMacro(<<"ReferenceSystemNormalArray with name specified does not exist");
276 return 1;
277 }
278
280 {
281 vtkErrorMacro(<<"ReferenceSystemUpNormalArrayName not specified");
282 return 1;
283 }
284
286
287 if (!referenceSystemUpNormalArray)
288 {
289 vtkErrorMacro(<<"ReferenceSystemUpNormalArray with name specified does not exist");
290 return 1;
291 }
292
294 {
295 vtkErrorMacro(<<"BifurcationVectorsArrayName not specified");
296 return 1;
297 }
298
300 {
301 vtkErrorMacro(<<"InPlaneBifurcationVectorsArrayName not specified");
302 return 1;
303 }
304
306 {
307 vtkErrorMacro(<<"OutOfPlaneBifurcationVectorsArrayName not specified");
308 return 1;
309 }
310
312 {
313 vtkErrorMacro(<<"BifurcationVectorsOrientationArrayName not specified");
314 return 1;
315 }
316
318 {
319 vtkErrorMacro(<<"BifurcationGroupIdsArrayName not specified");
320 return 1;
321 }
322
324 {
325 vtkErrorMacro(<<"InPlaneBifurcationVectorAnglesArrayName not specified");
326 return 1;
327 }
328
330 {
331 vtkErrorMacro(<<"OutOfPlaneBifurcationVectorAnglesArrayName not specified");
332 return 1;
333 }
334
335 vtkPoints* outputPoints = vtkPoints::New();
336 vtkCellArray* outputVerts = vtkCellArray::New();
337
338 output->SetPoints(outputPoints);
339 output->SetVerts(outputVerts);
340
341 vtkDoubleArray* bifurcationVectorsArray = vtkDoubleArray::New();
343 bifurcationVectorsArray->SetNumberOfComponents(3);
344
345 vtkDoubleArray* inPlaneBifurcationVectorsArray = vtkDoubleArray::New();
347 inPlaneBifurcationVectorsArray->SetNumberOfComponents(3);
348
349 vtkDoubleArray* outOfPlaneBifurcationVectorsArray = vtkDoubleArray::New();
351 outOfPlaneBifurcationVectorsArray->SetNumberOfComponents(3);
352
353 vtkDoubleArray* inPlaneBifurcationVectorAnglesArray = vtkDoubleArray::New();
355 inPlaneBifurcationVectorAnglesArray->SetNumberOfComponents(1);
356
357 vtkDoubleArray* outOfPlaneBifurcationVectorAnglesArray = vtkDoubleArray::New();
359 outOfPlaneBifurcationVectorAnglesArray->SetNumberOfComponents(1);
360
361 vtkIntArray* bifurcationVectorsOrientationArray = vtkIntArray::New();
363 bifurcationVectorsOrientationArray->SetNumberOfComponents(1);
364
365 vtkIntArray* bifurcationVectorsGroupIdsArray = vtkIntArray::New();
367 bifurcationVectorsGroupIdsArray->SetNumberOfComponents(1);
368
369 vtkIntArray* bifurcationVectorsBifurcationGroupIdsArray = vtkIntArray::New();
371 bifurcationVectorsBifurcationGroupIdsArray->SetNumberOfComponents(1);
372
373 output->GetPointData()->AddArray(bifurcationVectorsArray);
374 output->GetPointData()->AddArray(inPlaneBifurcationVectorsArray);
375 output->GetPointData()->AddArray(outOfPlaneBifurcationVectorsArray);
376 output->GetPointData()->AddArray(inPlaneBifurcationVectorAnglesArray);
377 output->GetPointData()->AddArray(outOfPlaneBifurcationVectorAnglesArray);
378 output->GetPointData()->AddArray(bifurcationVectorsOrientationArray);
379 output->GetPointData()->AddArray(bifurcationVectorsGroupIdsArray);
380 output->GetPointData()->AddArray(bifurcationVectorsBifurcationGroupIdsArray);
381
382 vtkIdList* blankedGroupIds = vtkIdList::New();
384 int i;
385 for (i=0; i<blankedGroupIds->GetNumberOfIds(); i++)
386 {
387 vtkIdType bifurcationGroupId = blankedGroupIds->GetId(i);
388
389 vtkIdList* groupBifurcationVectorsGroupIds = vtkIdList::New();
390 vtkIntArray* groupBifurcationVectorsOrientation = vtkIntArray::New();
391 vtkDoubleArray* groupBifurcationVectors = vtkDoubleArray::New();
392 vtkPoints* groupBifurcationVectorsPoints = vtkPoints::New();
393 vtkDoubleArray* groupInPlaneBifurcationVectors = vtkDoubleArray::New();
394 vtkDoubleArray* groupOutOfPlaneBifurcationVectors = vtkDoubleArray::New();
395 vtkDoubleArray* groupInPlaneBifurcationVectorAngles = vtkDoubleArray::New();
396 vtkDoubleArray* groupOutOfPlaneBifurcationVectorAngles = vtkDoubleArray::New();
397
398 this->
ComputeBifurcationVectors(input,bifurcationGroupId,groupBifurcationVectorsGroupIds,groupBifurcationVectorsOrientation,groupBifurcationVectors,groupBifurcationVectorsPoints);
400 this->
ComputeBifurcationVectorAngles(bifurcationGroupId,groupBifurcationVectors,groupInPlaneBifurcationVectors,groupOutOfPlaneBifurcationVectors,groupInPlaneBifurcationVectorAngles,groupOutOfPlaneBifurcationVectorAngles);
401
402 int j;
403 for (j=0; j<groupBifurcationVectorsGroupIds->GetNumberOfIds(); j++)
404 {
405 vtkIdType pointId = outputPoints->InsertNextPoint(groupBifurcationVectorsPoints->GetPoint(j));
406 outputVerts->InsertNextCell(1);
407 outputVerts->InsertCellPoint(pointId);
408
409 bifurcationVectorsArray->InsertNextTuple(groupBifurcationVectors->GetTuple(j));
410 inPlaneBifurcationVectorsArray->InsertNextTuple(groupInPlaneBifurcationVectors->GetTuple(j));
411 outOfPlaneBifurcationVectorsArray->InsertNextTuple(groupOutOfPlaneBifurcationVectors->GetTuple(j));
412 inPlaneBifurcationVectorAnglesArray->InsertNextTuple(groupInPlaneBifurcationVectorAngles->GetTuple(j));
413 outOfPlaneBifurcationVectorAnglesArray->InsertNextTuple(groupOutOfPlaneBifurcationVectorAngles->GetTuple(j));
414 bifurcationVectorsOrientationArray->InsertNextValue(groupBifurcationVectorsOrientation->GetValue(j));
415 bifurcationVectorsGroupIdsArray->InsertNextValue(groupBifurcationVectorsGroupIds->GetId(j));
416 bifurcationVectorsBifurcationGroupIdsArray->InsertNextValue(bifurcationGroupId);
417 }
418
419 groupBifurcationVectorsGroupIds->Delete();
420 groupBifurcationVectorsOrientation->Delete();
421 groupBifurcationVectors->Delete();
422 groupBifurcationVectorsPoints->Delete();
423 groupInPlaneBifurcationVectors->Delete();
424 groupOutOfPlaneBifurcationVectors->Delete();
425 groupInPlaneBifurcationVectorAngles->Delete();
426 groupOutOfPlaneBifurcationVectorAngles->Delete();
427 }
428
429 blankedGroupIds->Delete();
430
431 outputPoints->Delete();
432 outputVerts->Delete();
433
434 bifurcationVectorsArray->Delete();
435 inPlaneBifurcationVectorsArray->Delete();
436 outOfPlaneBifurcationVectorsArray->Delete();
437 inPlaneBifurcationVectorAnglesArray->Delete();
438 outOfPlaneBifurcationVectorAnglesArray->Delete();
439 bifurcationVectorsOrientationArray->Delete();
440 bifurcationVectorsGroupIdsArray->Delete();
441 bifurcationVectorsBifurcationGroupIdsArray->Delete();
442
443 return 1;
444}
void ComputeBifurcationVectorComponents(int bifurcationGroupId, vtkDoubleArray *bifurcationVectors, vtkDoubleArray *inPlaneBifurcationVectors, vtkDoubleArray *outOfPlaneBifurcationVectors)
void ComputeBifurcationVectors(vtkPolyData *input, int bifurcationGroupId, vtkIdList *bifurcationVectorsGroupIds, vtkIntArray *bifurcationVectorsOrientation, vtkDoubleArray *bifurcationVectors, vtkPoints *bifurcationVectorsPoints)
void ComputeBifurcationVectorAngles(int bifurcationGroupId, vtkDoubleArray *bifurcationVectors, vtkDoubleArray *inPlaneBifurcationVectors, vtkDoubleArray *outOfPlaneBifurcationVectors, vtkDoubleArray *inPlaneBifurcationVectorAngles, vtkDoubleArray *outOfPlaneBifurcationVectorAngles)
static void GetBlankedGroupsIdList(vtkPolyData *centerlines, const char *groupIdsArrayName, const char *blankingArrayName, vtkIdList *groupIds)