VTK-m  2.2
ANARIMapperVolume.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_interop_anari_ANARIMapperVolume_h
12 #define vtk_m_interop_anari_ANARIMapperVolume_h
13 
15 
16 namespace vtkm
17 {
18 namespace interop
19 {
20 namespace anari
21 {
22 
26 {
27  anari_cpp::Array3D Data{ nullptr };
28  int Dims[3];
29  float Origin[3];
30  float Spacing[3];
31 };
32 
34 {
35  anari_cpp::Array1D VertexPosition{ nullptr };
36  anari_cpp::Array1D VertexData{ nullptr };
37  anari_cpp::Array1D Index{ nullptr };
38  anari_cpp::Array1D CellIndex{ nullptr };
39  anari_cpp::Array1D CellData{ nullptr };
40  anari_cpp::Array1D CellType{ nullptr };
41  bool IndexPrefixed{ false };
42 };
43 
47 {
49  std::shared_ptr<vtkm::cont::Token> Token{ new vtkm::cont::Token };
50 };
51 
53 {
60  std::shared_ptr<vtkm::cont::Token> Token{ new vtkm::cont::Token };
61 };
62 
67 struct VTKM_ANARI_EXPORT ANARIMapperVolume : public ANARIMapper
68 {
72  anari_cpp::Device device,
73  const ANARIActor& actor = {},
74  const std::string& name = "<volume>",
76 
79  ~ANARIMapperVolume() override;
80 
84  void SetActor(const ANARIActor& actor) override;
85 
89  void SetANARIColorMap(anari_cpp::Array1D color,
90  anari_cpp::Array1D opacity,
91  bool releaseArrays = true) override;
94  void SetANARIColorMapValueRange(const vtkm::Vec2f_32& valueRange) override;
95 
98  void SetANARIColorMapOpacityScale(vtkm::Float32 opacityScale) override;
99 
100  anari_cpp::SpatialField GetANARISpatialField() override;
101  anari_cpp::Volume GetANARIVolume() override;
102 
103 private:
107  void ConstructArrays(bool regenerate = false);
109  void UpdateSpatialField();
110 
113  {
114  anari_cpp::Device Device{ nullptr };
115  anari_cpp::SpatialField SpatialField{ nullptr };
116  anari_cpp::Volume Volume{ nullptr };
119  ~ANARIHandles();
120  void ReleaseArrays();
121  };
122 
123  std::shared_ptr<ANARIHandles> Handles;
126 };
127 
128 } // namespace anari
129 } // namespace interop
130 } // namespace vtkm
131 
132 #endif
vtkm::interop::anari::UnstructuredVolumeParameters::VertexData
anari_cpp::Array1D VertexData
Definition: ANARIMapperVolume.h:36
vtkm::interop::anari::UntructuredVolumeArrays::CellType
vtkm::cont::ArrayHandle< vtkm::UInt8 > CellType
Definition: ANARIMapperVolume.h:59
anari
Definition: VtkmANARITypes.h:30
ANARIMapper.h
vtkm::cont::ArrayHandle< vtkm::Float32 >
vtkm::interop::anari::UnstructuredVolumeParameters::VertexPosition
anari_cpp::Array1D VertexPosition
Definition: ANARIMapperVolume.h:35
vtkm::interop::anari::UntructuredVolumeArrays::VertexPosition
vtkm::cont::ArrayHandle< vtkm::Vec3f_32 > VertexPosition
Definition: ANARIMapperVolume.h:54
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:89
vtkm::interop::anari::UnstructuredVolumeParameters
Definition: ANARIMapperVolume.h:33
vtkm::interop::anari::StructuredVolumeArrays::Token
std::shared_ptr< vtkm::cont::Token > Token
Definition: ANARIMapperVolume.h:49
vtkm::interop::anari::StructuredVolumeParameters::Dims
int Dims[3]
Definition: ANARIMapperVolume.h:28
vtkm::interop::anari::UnstructuredVolumeParameters::IndexPrefixed
bool IndexPrefixed
Definition: ANARIMapperVolume.h:41
vtkm::interop::anari::ANARIMapperVolume::ANARIHandles
Container of all relevant ANARI scene object handles.
Definition: ANARIMapperVolume.h:112
vtkm::interop::anari::ANARIMapper
This is the base class used for all ANARI mappers.
Definition: ANARIMapper.h:37
vtkm::interop::anari::StructuredVolumeParameters
Raw ANARI arrays and parameter values set on the ANARISpatialField.
Definition: ANARIMapperVolume.h:25
vtkm::interop::anari::UnstructuredVolumeParameters::CellData
anari_cpp::Array1D CellData
Definition: ANARIMapperVolume.h:39
vtkm::interop::anari::UntructuredVolumeArrays::CellData
vtkm::cont::ArrayHandle< vtkm::Float32 > CellData
Definition: ANARIMapperVolume.h:58
vtkm::interop::anari::StructuredVolumeArrays
VTK-m data arrays underlying the ANARIArray handles created by the mapper.
Definition: ANARIMapperVolume.h:46
vtkm::interop::anari::UntructuredVolumeArrays::CellIndex
vtkm::cont::ArrayHandle< vtkm::UInt64 > CellIndex
Definition: ANARIMapperVolume.h:57
vtkm::interop::anari::ANARIMapperVolume::StructuredArrays
StructuredVolumeArrays StructuredArrays
Definition: ANARIMapperVolume.h:124
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::interop::anari::ANARIMapperVolume::Handles
std::shared_ptr< ANARIHandles > Handles
Definition: ANARIMapperVolume.h:123
vtkm::interop::anari::UnstructuredVolumeParameters::Index
anari_cpp::Array1D Index
Definition: ANARIMapperVolume.h:37
vtkm::interop::anari::UntructuredVolumeArrays::Token
std::shared_ptr< vtkm::cont::Token > Token
Definition: ANARIMapperVolume.h:60
vtkm::interop::anari::ANARIActor
Collects cells, coords, and 0-4 fields for ANARI mappers to consume.
Definition: ANARIActor.h:52
vtkm::interop::anari::UnstructuredVolumeParameters::CellType
anari_cpp::Array1D CellType
Definition: ANARIMapperVolume.h:40
vtkm::interop::anari::UntructuredVolumeArrays::VertexData
vtkm::cont::ArrayHandle< vtkm::Float32 > VertexData
Definition: ANARIMapperVolume.h:55
vtkm::interop::anari::UntructuredVolumeArrays::Index
vtkm::cont::ArrayHandle< vtkm::UInt64 > Index
Definition: ANARIMapperVolume.h:56
vtkm::interop::anari::ANARIMapperVolume::UnstructuredArrays
UntructuredVolumeArrays UnstructuredArrays
Definition: ANARIMapperVolume.h:125
vtkm::interop::anari::StructuredVolumeArrays::Data
vtkm::cont::ArrayHandle< vtkm::Float32 > Data
Definition: ANARIMapperVolume.h:48
vtkm::interop::anari::ANARIMapperVolume::ANARIHandles::StructuredParameters
StructuredVolumeParameters StructuredParameters
Definition: ANARIMapperVolume.h:117
vtkm::interop::anari::StructuredVolumeParameters::Spacing
float Spacing[3]
Definition: ANARIMapperVolume.h:30
vtkm::interop::anari::UntructuredVolumeArrays
Definition: ANARIMapperVolume.h:52
vtkm::cont::ColorTable::Preset::Default
@ Default
vtkm::Vec< vtkm::Float32, 2 >
vtkm::interop::anari::ANARIMapperVolume::ANARIHandles::UnstructuredParameters
UnstructuredVolumeParameters UnstructuredParameters
Definition: ANARIMapperVolume.h:118
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
vtkm::interop::anari::ANARIMapperVolume
Mapper which turns structured volumes into a single ANARI transferFunction1D volume.
Definition: ANARIMapperVolume.h:67
vtkm::interop::anari::StructuredVolumeParameters::Data
anari_cpp::Array3D Data
Definition: ANARIMapperVolume.h:27
vtkm::interop::anari::StructuredVolumeParameters::Origin
float Origin[3]
Definition: ANARIMapperVolume.h:29
vtkm::interop::anari::UnstructuredVolumeParameters::CellIndex
anari_cpp::Array1D CellIndex
Definition: ANARIMapperVolume.h:38