@@ -76,7 +76,7 @@ namespace itk
76
76
77
77
template <typename TOutputMesh,
78
78
typename ConvertPointPixelTraits = MeshConvertPixelTraits<typename TOutputMesh::PixelType>,
79
- class ConvertCellPixelTraits = MeshConvertPixelTraits<typename TOutputMesh::CellPixelType>>
79
+ typename ConvertCellPixelTraits = MeshConvertPixelTraits<typename TOutputMesh::CellPixelType>>
80
80
class ITK_TEMPLATE_EXPORT MeshFileReader : public MeshSource<TOutputMesh>
81
81
{
82
82
public:
@@ -187,6 +187,29 @@ class ITK_TEMPLATE_EXPORT MeshFileReader : public MeshSource<TOutputMesh>
187
187
private:
188
188
std::string m_ExceptionMessage;
189
189
};
190
+
191
+
192
+ /* * Convenience function for reading a mesh.
193
+ *
194
+ * `TOutputMesh` is the expected output mesh type, and the optional
195
+ * `ConvertPointPixelTraits`, ``ConvertCellPixelTraits` template parameters are used to do the conversion,
196
+ * as specified by MeshFileReader.
197
+ *
198
+ * The function reads the mesh from the specified file, and returns the
199
+ * mesh that it has read.
200
+ * */
201
+ template <typename TOutputMesh,
202
+ typename ConvertPointPixelTraits = MeshConvertPixelTraits<typename TOutputMesh::PixelType>,
203
+ typename ConvertCellPixelTraits = MeshConvertPixelTraits<typename TOutputMesh::CellPixelType>>
204
+ typename TOutputMesh::Pointer
205
+ ReadMesh (const std::string & filename)
206
+ {
207
+ const auto reader = MeshFileReader<TOutputMesh, ConvertPointPixelTraits, ConvertCellPixelTraits>::New ();
208
+ reader->SetFileName (filename);
209
+ reader->Update ();
210
+ return reader->GetOutput ();
211
+ }
212
+
190
213
} // end namespace itk
191
214
192
215
#ifndef ITK_MANUAL_INSTANTIATION
0 commit comments