MCPcopy Create free account
hub / github.com/MITK/MITK / GenerateData

Method GenerateData

Modules/AlgorithmsExt/src/mitkHeightFieldSurfaceClipImageFilter.cpp:339–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337 }
338
339 void HeightFieldSurfaceClipImageFilter::GenerateData()
340 {
341 const Image *inputImage = this->GetInput(0);
342
343 const Image *outputImage = this->GetOutput();
344
345 m_InputTimeSelector->SetInput(inputImage);
346 m_OutputTimeSelector->SetInput(outputImage);
347
348 Image::RegionType outputRegion = outputImage->GetRequestedRegion();
349 const TimeGeometry *outputTimeGeometry = outputImage->GetTimeGeometry();
350 const TimeGeometry *inputTimeGeometry = inputImage->GetTimeGeometry();
351 ScalarType timeInMS;
352
353 int timestep = 0;
354 int tstart = outputRegion.GetIndex(3);
355 int tmax = tstart + outputRegion.GetSize(3);
356
357 for (unsigned int i = 1; i < this->GetNumberOfInputs(); ++i)
358 {
359 Surface *inputSurface = dynamic_cast<Surface *>(itk::ProcessObject::GetInput(i));
360
361 if (!outputImage->IsInitialized() || inputSurface == nullptr)
362 return;
363
364 MITK_INFO << "Plane: " << i;
365 MITK_INFO << "Clipping: Start\n";
366
367 // const PlaneGeometry *clippingGeometryOfCurrentTimeStep = nullptr;
368
369 int t;
370 for (t = tstart; t < tmax; ++t)
371 {
372 timeInMS = outputTimeGeometry->TimeStepToTimePoint(t);
373 timestep = inputTimeGeometry->TimePointToTimeStep(timeInMS);
374
375 m_InputTimeSelector->SetTimeNr(timestep);
376 m_InputTimeSelector->UpdateLargestPossibleRegion();
377 m_OutputTimeSelector->SetTimeNr(t);
378 m_OutputTimeSelector->UpdateLargestPossibleRegion();
379
380 // Compose IndexToWorld transform of image with WorldToIndexTransform of
381 // clipping data for conversion from image index space to plane index space
382 AffineTransform3D::Pointer planeWorldToIndexTransform = AffineTransform3D::New();
383 inputSurface->GetGeometry(t)->GetIndexToWorldTransform()->GetInverse(planeWorldToIndexTransform);
384
385 AffineTransform3D::Pointer imageToPlaneTransform = AffineTransform3D::New();
386 imageToPlaneTransform->SetIdentity();
387
388 imageToPlaneTransform->Compose(inputTimeGeometry->GetGeometryForTimeStep(t)->GetIndexToWorldTransform());
389 imageToPlaneTransform->Compose(planeWorldToIndexTransform);
390
391 MITK_INFO << "Accessing ITK function...\n";
392 if (i == 1)
393 {
394 AccessFixedDimensionByItk_3(m_InputTimeSelector->GetOutput(),
395 _InternalComputeClippedImage,
396 3,

Callers

nothing calls this directly

Calls 15

GetGeometryMethod · 0.80
NewFunction · 0.50
GetInputMethod · 0.45
GetOutputMethod · 0.45
SetInputMethod · 0.45
GetIndexMethod · 0.45
GetSizeMethod · 0.45
IsInitializedMethod · 0.45
TimeStepToTimePointMethod · 0.45
TimePointToTimeStepMethod · 0.45
SetIdentityMethod · 0.45

Tested by

no test coverage detected