91 using PolyDataType = TPolyData;
95 using PointPixelType =
typename TPolyData::PixelType;
102 using CellPixelType =
typename TPolyData::CellPixelType;
109 polyDataJSON.
name = polyData->GetObjectName();
112 if (polyData->GetPointData() !=
nullptr)
117 if (polyData->GetPointData() !=
nullptr)
122 if (polyData->GetPointData() !=
nullptr)
127 if (polyData->GetPointData() !=
nullptr)
132 if (polyData->GetPointData() !=
nullptr)
137 if (polyData->GetCellData() !=
nullptr)
142 size_t pointsAddress = 0;
143 if (polyData->GetNumberOfPoints())
145 pointsAddress =
reinterpret_cast<size_t>(&(polyData->GetPoints()->at(0)));
147 std::ostringstream pointsStream;
148 pointsStream <<
"data:application/vnd.itk.address,0:";
149 pointsStream << pointsAddress;
150 polyDataJSON.
points = pointsStream.str();
152 size_t verticesAddress = 0;
153 if (polyData->GetVertices() !=
nullptr && polyData->GetVertices()->Size() > 0)
155 verticesAddress =
reinterpret_cast<size_t>(&(polyData->GetVertices()->at(0)));
157 std::ostringstream verticesStream;
158 verticesStream <<
"data:application/vnd.itk.address,0:";
159 verticesStream << verticesAddress;
160 polyDataJSON.
vertices = verticesStream.str();
162 size_t linesAddress = 0;
163 if (polyData->GetLines() !=
nullptr && polyData->GetLines()->Size() > 0)
165 linesAddress =
reinterpret_cast<size_t>(&(polyData->GetLines()->at(0)));
167 std::ostringstream linesStream;
168 linesStream <<
"data:application/vnd.itk.address,0:";
169 linesStream << linesAddress;
170 polyDataJSON.
lines = linesStream.str();
172 size_t polygonsAddress = 0;
173 if (polyData->GetPolygons() !=
nullptr && polyData->GetPolygons()->Size() > 0)
175 polygonsAddress =
reinterpret_cast<size_t>(&(polyData->GetPolygons()->at(0)));
177 std::ostringstream polygonsStream;
178 polygonsStream <<
"data:application/vnd.itk.address,0:";
179 polygonsStream << polygonsAddress;
180 polyDataJSON.
polygons = polygonsStream.str();
182 size_t triangleStripsAddress = 0;
183 if (polyData->GetTriangleStrips() !=
nullptr && polyData->GetTriangleStrips()->Size() > 0)
185 triangleStripsAddress =
reinterpret_cast<size_t>(&(polyData->GetTriangleStrips()->at(0)));
187 std::ostringstream triangleStripsStream;
188 triangleStripsStream <<
"data:application/vnd.itk.address,0:";
189 triangleStripsStream << triangleStripsAddress;
192 size_t pointDataAddress = 0;
193 if (polyData->GetPointData() !=
nullptr && polyData->GetPointData()->Size() > 0)
195 pointDataAddress =
reinterpret_cast<size_t>(&(polyData->GetPointData()->at(0)));
197 std::ostringstream pointDataStream;
198 pointDataStream <<
"data:application/vnd.itk.address,0:";
199 pointDataStream << pointDataAddress;
200 polyDataJSON.
pointData = pointDataStream.str();
202 size_t cellDataAddress = 0;
203 if (polyData->GetCellData() !=
nullptr && polyData->GetCellData()->Size() > 0)
205 cellDataAddress =
reinterpret_cast<size_t>(&(polyData->GetCellData()->at(0)));
207 std::ostringstream cellDataStream;
208 cellDataStream <<
"data:application/vnd.itk.address,0:";
209 cellDataStream << cellDataAddress;
210 polyDataJSON.
cellData = cellDataStream.str();
212 auto dictionary = polyData->GetMetaDataDictionary();