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.
| 44 | // boundingbox. This method returns null if a non-empty image cannot be |
| 45 | // generated for the given input and bounds. |
| 46 | vtkSmartPointer<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 | |
| 75 | vtkSmartPointer<vtkIdList> get_ids(vtkDataSetAttributes* source, unsigned char ghostFlag) |
| 76 | { |
no test coverage detected