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

Method ProcessRequest

Rendering/Image/vtkImageResliceMapper.cxx:315–470  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

313
314//------------------------------------------------------------------------------
315vtkTypeBool vtkImageResliceMapper::ProcessRequest(
316 vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
317{
318 if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_INFORMATION()))
319 {
320 // use superclass method to update some info
321 this->Superclass::ProcessRequest(request, inputVector, outputVector);
322
323 // need the prop and renderer
324 vtkImageSlice* prop = this->GetCurrentProp();
325 vtkRenderer* ren = this->GetCurrentRenderer();
326
327 if (ren && prop)
328 {
329 vtkImageProperty* property = prop->GetProperty();
330
331 // Get point/normal from camera
332 if (this->SliceFacesCamera || this->SliceAtFocalPoint)
333 {
334 vtkCamera* camera = ren->GetActiveCamera();
335
336 if (this->SliceFacesCamera)
337 {
338 double normal[3];
339 camera->GetDirectionOfProjection(normal);
340 normal[0] = -normal[0];
341 normal[1] = -normal[1];
342 normal[2] = -normal[2];
343 this->SlicePlane->SetNormal(normal);
344 }
345
346 if (this->SliceAtFocalPoint)
347 {
348 double point[4];
349 camera->GetFocalPoint(point);
350
351 if (this->JumpToNearestSlice)
352 {
353 double normal[4];
354 this->SlicePlane->GetNormal(normal);
355 normal[3] = -vtkMath::Dot(point, normal);
356 point[3] = 1.0;
357
358 // convert normal from world to image coordinates
359 double worldToData[16];
360 vtkMatrix4x4* dataToWorld = this->GetDataToWorldMatrix();
361 vtkMatrix4x4::Transpose(dataToWorld->GetData(), worldToData);
362 vtkMatrix4x4::MultiplyPoint(worldToData, normal, normal);
363 double dataToImage[9];
364 vtkMatrix3x3::Transpose(this->DataDirection, dataToImage);
365 vtkMatrix3x3::MultiplyPoint(dataToImage, normal, normal);
366
367 // find the slice orientation from the normal
368 int k = 0;
369 double maxsq = 0;
370 double sumsq = 0;
371 for (int i = 0; i < 3; i++)
372 {

Callers

nothing calls this directly

Calls 15

UpdateResliceMatrixMethod · 0.95
UpdatePolygonCoordsMethod · 0.95
GetActiveCameraMethod · 0.80
GetDataToWorldMatrixMethod · 0.80
GetInformationObjectMethod · 0.80
DotFunction · 0.50
TransposeFunction · 0.50
MultiplyPointFunction · 0.50
InvertFunction · 0.50

Tested by

no test coverage detected