18 #ifndef itkMeshFileWriter_h
19 #define itkMeshFileWriter_h
51 template <
typename TInputMesh>
78 using Superclass::SetInput;
86 GetInput(
unsigned int idx);
89 itkSetStringMacro(FileName);
90 itkGetStringMacro(FileName);
105 if (this->m_MeshIO != io)
110 m_FactorySpecifiedMeshIO =
false;
111 m_UserSpecifiedMeshIO =
true;
113 itkGetModifiableObjectMacro(MeshIO,
MeshIOBase);
119 m_FileTypeIsBINARY =
false;
124 m_FileTypeIsBINARY =
true;
142 itkSetMacro(UseCompression,
bool);
143 itkGetConstReferenceMacro(UseCompression,
bool);
144 itkBooleanMacro(UseCompression);
151 PrintSelf(std::ostream & os,
Indent indent)
const override;
153 template <
typename Output>
155 CopyPointsToBuffer(Output * data);
157 template <
typename Output>
159 CopyCellsToBuffer(Output * data);
161 template <
typename Output>
163 CopyPointDataToBuffer(Output * data);
165 template <
typename Output>
167 CopyCellDataToBuffer(Output * data);
182 std::string m_FileName{};
184 bool m_UserSpecifiedMeshIO{};
186 bool m_FactorySpecifiedMeshIO{};
188 bool m_UseCompression{};
189 bool m_FileTypeIsBINARY{};
197 template <
typename TMeshPo
inter>
198 ITK_TEMPLATE_EXPORT
void
199 WriteMesh(TMeshPointer && mesh,
const std::string & filename,
bool compress =
false)
201 using NonReferenceMeshPointer = std::remove_reference_t<TMeshPointer>;
202 static_assert(std::is_pointer_v<NonReferenceMeshPointer> || mpl::IsSmartPointer<NonReferenceMeshPointer>::Value,
203 "WriteMesh requires a raw pointer or SmartPointer.");
206 using MeshType = std::remove_const_t<std::remove_reference_t<decltype(*mesh)>>;
208 writer->SetInput(mesh);
209 writer->SetFileName(filename);
210 writer->SetUseCompression(compress);
216 #ifndef ITK_MANUAL_INSTANTIATION
217 # include "itkMeshFileWriter.hxx"
220 #if defined ITK_MESHIO_FACTORY_REGISTER_MANAGER || defined ITK_IO_FACTORY_REGISTER_MANAGER
221 # include "itkMeshIOFactoryRegisterManager.h"
224 #endif // itkMeshFileWriter_h