83#ifndef ITK_WASM_NO_MEMORY_IO
84 if (!this->
m_PolyData.IsNull() && !this->m_Identifier.empty())
87 auto polyDataToWasmPolyDataFilter = PolyDataToWasmPolyDataFilterType::New();
88 polyDataToWasmPolyDataFilter->SetInput(this->
m_PolyData);
89 polyDataToWasmPolyDataFilter->Update();
90 auto wasmPolyData = polyDataToWasmPolyDataFilter->GetOutput();
96 const auto pointsAddress =
reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetPoints()->at(0)));
97 const auto pointsSize = wasmPolyData->GetPolyData()->GetPoints()->Size() * PolyDataType::PointDimension *
98 sizeof(
typename PolyDataType::CoordinateType);
102 if (this->
m_PolyData->GetVertices() && this->m_PolyData->GetVertices()->Size() > 0)
104 const auto verticesAddress =
reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetVertices()->at(0)));
105 const auto verticesSize = wasmPolyData->GetPolyData()->GetVertices()->Size() *
sizeof(uint32_t);
109 if (this->
m_PolyData->GetLines() && this->m_PolyData->GetLines()->Size() > 0)
111 const auto linesAddress =
reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetLines()->at(0)));
112 const auto linesSize = wasmPolyData->GetPolyData()->GetLines()->Size() *
sizeof(uint32_t);
116 if (this->
m_PolyData->GetPolygons() && this->m_PolyData->GetPolygons()->Size() > 0)
118 const auto polygonsAddress =
reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetPolygons()->at(0)));
119 const auto polygonsSize = wasmPolyData->GetPolyData()->GetPolygons()->Size() *
sizeof(uint32_t);
123 if (this->
m_PolyData->GetTriangleStrips() && this->m_PolyData->GetTriangleStrips()->Size() > 0)
125 const auto triangleStripsAddress =
126 reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetTriangleStrips()->at(0)));
127 const auto triangleStripsSize = wasmPolyData->GetPolyData()->GetTriangleStrips()->Size() *
sizeof(uint32_t);
131 if (this->
m_PolyData->GetPointData() !=
nullptr && this->m_PolyData->GetPointData()->Size() > 0)
133 using PointPixelType =
typename PolyDataType::PixelType;
135 const auto pointDataAddress =
reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetPointData()->at(0)));
136 const auto pointDataSize = wasmPolyData->GetPolyData()->GetPointData()->Size() *
137 sizeof(
typename ConvertPointPixelTraits::ComponentType) *
138 ConvertPointPixelTraits::GetNumberOfComponents();
142 if (this->
m_PolyData->GetCellData() !=
nullptr && this->m_PolyData->GetCellData()->Size() > 0)
144 using CellPixelType =
typename PolyDataType::CellPixelType;
146 const auto cellDataAddress =
reinterpret_cast<size_t>(&(wasmPolyData->GetPolyData()->GetCellData()->at(0)));
147 const auto cellDataSize = wasmPolyData->GetPolyData()->GetCellData()->Size() *
148 sizeof(
typename ConvertCellPixelTraits::ComponentType) *
149 ConvertCellPixelTraits::GetNumberOfComponents();
154 std::cerr <<
"Memory IO not supported" << std::endl;
160#ifndef ITK_WASM_NO_FILESYSTEM_IO
161 if (!this->
m_PolyData.IsNull() && !this->m_Identifier.empty())
164 auto polyDataToMeshFilter = PolyDataToMeshFilterType::New();
165 polyDataToMeshFilter->SetInput(this->
m_PolyData);
166 using MeshType =
typename PolyDataToMeshFilterType::OutputMeshType;
168 auto meshWriter = MeshWriterType::New();
170 meshWriter->SetInput(polyDataToMeshFilter->GetOutput());
171 meshWriter->Update();
174 std::cerr <<
"Filesystem IO not supported" << std::endl;