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

Function resample

Filters/ParallelDIY2/vtkAdaptiveResampleToImage.cxx:46–73  ·  view source on GitHub ↗

Resamples the input dataset to an image dataset spanning the requested boundingbox. This method returns null if a non-empty image cannot be generated for the given input and bounds.

Source from the content-addressed store, hash-verified

44// boundingbox. This method returns null if a non-empty image cannot be
45// generated for the given input and bounds.
46vtkSmartPointer<vtkImageData> resample(
47 const vtkBoundingBox& bbox, vtkDataObject* input, vtkAdaptiveResampleToImage* self)
48{
49 assert(bbox.IsValid());
50
51 double bds[6];
52 bbox.GetBounds(bds);
53
54 vtkNew<vtkPResampleToImage> resampler;
55 resampler->SetController(nullptr);
56 resampler->SetUseInputBounds(false);
57 resampler->SetSamplingDimensions(self->GetSamplingDimensions());
58 resampler->SetSamplingBounds(bds);
59 resampler->SetInputDataObject(input);
60 resampler->Update();
61 auto image = resampler->GetOutput();
62
63 auto cellmask = get_mask_array(image->GetCellData());
64 auto pointmask = get_mask_array(image->GetPointData());
65 if ((static_cast<int>(cellmask->GetRange(0)[0]) & vtkDataSetAttributes::HIDDENCELL) != 0 &&
66 (static_cast<int>(pointmask->GetRange(0)[0]) & vtkDataSetAttributes::HIDDENPOINT) != 0)
67 {
68 // if image has nothing valid, return empty.
69 return nullptr;
70 }
71
72 return image;
73}
74
75vtkSmartPointer<vtkIdList> get_ids(vtkDataSetAttributes* source, unsigned char ghostFlag)
76{

Callers 1

RequestDataMethod · 0.85

Calls 10

assertFunction · 0.50
IsValidMethod · 0.45
GetBoundsMethod · 0.45
SetControllerMethod · 0.45
SetInputDataObjectMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
GetCellDataMethod · 0.45
GetPointDataMethod · 0.45
GetRangeMethod · 0.45

Tested by

no test coverage detected