This method is called by the superclass and sets the update extent of the input image to the wholeextent
199{
200
201 vtkInformation* outInfo = outputVector->GetInformationObject(0);
202 vtkImageData *outputImage = vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
203 vtkInformation *inInfoImage = inputVector[0]->GetInformationObject(0);
204 vtkImageData *inputImage = vtkImageData::SafeDownCast(inInfoImage->Get(vtkDataObject::DATA_OBJECT()));
205
207 {
208 vtkErrorMacro(<<"Centerline not set");
209 return 1;
210 }
211
212 if (inputImage == NULL)
213 {
214 vtkErrorMacro(<< "RequestData: InputImageData is not set.");
215 return 1;
216 }
217
218
219 if (inputImage == NULL || outputImage==NULL)
220 {
221 if (outputImage)
222 {
223 int outputExtent[6] = {0,-1,0,-1,0,-1};
224 outputImage->SetExtent(outputExtent);
225 if (this->GetOutputInformation(0))
226 {
227 this->GetOutputInformation(0)->Set(
228 vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
229 this->GetOutputInformation(0)->Get(
230 vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()), 6);
231 }
232 outputImage->AllocateScalars(outInfo);
233 }
234
235 }
236
237
239 {
240 vtkErrorMacro(<< "RequestData: FrenetTangentArrayName is not set.");
241 return 1;
242 }
243
245 if (!frenetArray)
246 {
247 vtkErrorMacro(<< "RequestData: InputPolyData does not contain an array with the specified FrenetTangentArrayName.");
248 return 1;
249 }
250
251
253 {
254 vtkErrorMacro(<< "RequestData: ParallelTransportNormalsArrayName is not set.");
255 return 1;
256 }
257
258
260 if (!parallelArray)
261 {
262 vtkErrorMacro(<< "RequestData: InputPolyData does not contain an array with the specified ParallelTransportNormalsArrayName.");
263 return 1;
264 }
265
266 int firstLineInCells;
267 vtkCell* line = NULL;
268
269 for (firstLineInCells=0; firstLineInCells<this->
Centerline->GetNumberOfCells(); firstLineInCells++)
270 {
271 line = this->
Centerline->GetCell(firstLineInCells);
272 if (line->GetCellType() == VTK_LINE || line->GetCellType() == VTK_POLY_LINE)
273 {
274 break;
275 }
276 }
277
278 if (!line || (!(firstLineInCells < (
int) this->
Centerline->GetNumberOfCells())))
279 {
280 vtkErrorMacro(<< "RequestData: no line in input vtkPolyData.");
281 return 1;
282 }
283
284 if (line->GetNumberOfPoints() < 2)
285 {
286 vtkErrorMacro(<< "RequestData: Too few points in Centerline.");
287 return 1;
288 }
289
290 vtkPoints* linePoints = line->GetPoints();
291
292 int outExtent[6];
293 outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), outExtent);
294
295 outputImage->SetExtent(outExtent);
296 if (this->GetOutputInformation(0))
297 {
298 this->GetOutputInformation(0)->Set(
299 vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(),
300 this->GetOutputInformation(0)->Get(
301 vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()), 6);
302 }
303
306
307
308 int inExtent[6];
309 inInfoImage->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), inExtent);
310
311
312 if (inExtent[1] < inExtent[0] ||
313 inExtent[3] < inExtent[2] ||
314 inExtent[5] < inExtent[4])
315 {
316 return 1;
317 }
318
319 vtkImageReslice* reslice = vtkImageReslice::New();
320 reslice->SetOutputDimensionality(2);
321 reslice->SetInputData(inputImage);
322 reslice->SetInterpolationModeToCubic();
323
324 reslice->TransformInputSamplingOff();
325
327
328
330
331 for (int slice=outExtent[4]; slice<(outExtent[5] + 1);slice++)
332 {
333 double centerSlice[3];
334 linePoints->GetPoint(slice,centerSlice);
335
336
337
338
339 double t[3];
340 frenetTangentArray->GetTuple(slice,t);
341
342
343 double p[3];
344 parallelTransportNormalsArray->GetTuple(slice,p);
345
346 double tp[3];
347
348 tp[0] = (t[1]*p[2]- t[2]*p[1]);
349 tp[1] = (t[2]*p[0]- t[0]*p[2]);
350 tp[2] = (t[0]*p[1]- t[1]*p[0]);
351
352
353 reslice->SetResliceAxesDirectionCosines(p[0],p[1],p[2],tp[0],tp[1],tp[2],t[0],t[1],t[2]);
354
355 reslice->SetResliceAxesOrigin(centerSlice[0],centerSlice[1],centerSlice[2]);
356
358
359 double outputorigin[3];
360 outputorigin[0] = 0.0;
361 outputorigin[1] = 0.0;
362 outputorigin[2] = 0.0;
363
365 reslice->Update();
366
367 int resliceUpdateExtent[6];
368 resliceUpdateExtent[0] = outExtent[0];
369 resliceUpdateExtent[1] = outExtent[1];
370 resliceUpdateExtent[2] = outExtent[2];
371 resliceUpdateExtent[3] = outExtent[3];
372 resliceUpdateExtent[4] = 0;
373 resliceUpdateExtent[5] = 0;
374
375 vtkIdType outputInc[3];
376 outputImage->GetIncrements(outputInc);
377
378 int scalarType = reslice->GetOutput()->GetScalarType();
379 switch (scalarType)
380 {
381 vtkTemplateMacro(
383 static_cast<VTK_TT*>(reslice->GetOutput()->GetScalarPointerForExtent(resliceUpdateExtent)),
384 static_cast<VTK_TT*>(outputImage->GetScalarPointerForExtent(outExtent)),
385 resliceUpdateExtent, outExtent, outputInc, slice));
386 }
387 }
388
389 reslice->Delete();
390 return 1;
391}
void FillSlice(T *outReslicePtr, T *outputImagePtr, int *resliceUpdateExtent, int *outExtent, vtkIdType *outputInc, int slice)