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

Method ExtractVolumeRenderingSetup

IO/Export/vtkJSONSceneExporter.cxx:303–384  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

301
302//------------------------------------------------------------------------------
303std::string vtkJSONSceneExporter::ExtractVolumeRenderingSetup(vtkVolume* volume)
304{
305 vtkVolumeProperty* property = volume->GetProperty();
306
307 double* p3dPosition = volume->GetPosition();
308 double* p3dScale = volume->GetScale();
309 double* p3dOrigin = volume->GetOrigin();
310 double* p3dRotateWXYZ = volume->GetOrientationWXYZ();
311
312 int interpolationType = property->GetInterpolationType();
313
314 vtkTypeBool independentComponents = property->GetIndependentComponents();
315 int shade = property->GetShade();
316 double ambient = property->GetAmbient();
317 double diffuse = property->GetDiffuse();
318 double specular = property->GetSpecular();
319 double specularPower = property->GetSpecularPower();
320
321 constexpr const char* INDENT = " ";
322 std::stringstream renderingConfig;
323 renderingConfig << ",\n"
324 << "\"volume\": {\n"
325 << INDENT << " \"origin\": [" << p3dOrigin[0] << ", " << p3dOrigin[1] << ", "
326 << p3dOrigin[2] << "],\n"
327 << INDENT << " \"scale\": [" << p3dScale[0] << ", " << p3dScale[1] << ", "
328 << p3dScale[2] << "],\n"
329 << INDENT << " \"position\": [" << p3dPosition[0] << ", " << p3dPosition[1]
330 << ", " << p3dPosition[2] << "]\n"
331 << INDENT << "},\n"
332 << INDENT << "\"volumeRotation\": [" << p3dRotateWXYZ[0] << ", "
333 << p3dRotateWXYZ[1] << ", " << p3dRotateWXYZ[2] << ", " << p3dRotateWXYZ[3]
334 << "],\n"
335 << INDENT << "\"mapper\": {},\n"
336 << INDENT << "\"property\": {\n"
337 << INDENT << " \"interpolationType\": " << interpolationType << ",\n"
338 << INDENT
339 << " \"independentComponents\": " << (independentComponents ? "true" : "false")
340 << ",\n"
341 << INDENT << " \"ambient\": " << ambient << ",\n"
342 << INDENT << " \"diffuse\": " << diffuse << ",\n"
343 << INDENT << " \"specular\": " << specular << ",\n"
344 << INDENT << " \"specularPower\": " << specularPower << ",\n"
345 << INDENT << " \"shade\": " << shade << ",\n"
346 << INDENT << " \"components\": [\n";
347 for (vtkIdType component = 0; component < VTK_MAX_VRCOMP; ++component)
348 {
349 renderingConfig << INDENT << " {\n";
350 int colorChannels = property->GetColorChannels(component);
351 renderingConfig << INDENT << " \"colorChannels\": " << colorChannels << ",\n";
352 if (colorChannels == 3)
353 {
354 renderingConfig << INDENT << " \"rgbTransferFunction\":\n"
355 << INDENT << " {\n"
356 << this->ExtractColorTransferFunctionSetup(
357 property->GetRGBTransferFunction(component))
358 << INDENT << " },\n";
359 }
360 else if (colorChannels == 1)

Callers 1

WriteDataObjectMethod · 0.95

Calls 15

GetShadeMethod · 0.80
GetSpecularPowerMethod · 0.80
GetColorChannelsMethod · 0.80
GetScalarOpacityMethod · 0.80
GetPropertyMethod · 0.45
GetPositionMethod · 0.45
GetScaleMethod · 0.45

Tested by

no test coverage detected