20 #ifndef MIRTK_PointSetIO_H 21 #define MIRTK_PointSetIO_H 23 #include "mirtk/IOConfig.h" 24 #include "mirtk/PointSet.h" 26 #include "vtkSmartPointer.h" 27 #include "vtkDataSet.h" 28 #include "vtkPointSet.h" 29 #include "vtkPolyData.h" 30 #include "vtkPointData.h" 31 #include "vtkCellArray.h" 33 #if MIRTK_IO_WITH_GIFTI 34 #include "vtkPoints.h" 35 #include "vtkDataArray.h" 36 #include "vtkInformationStringKey.h" 37 #include "vtkInformationIntegerKey.h" 38 #include "vtkInformationDoubleKey.h" 57 #define HANDLE_POINTSETIO_OPTION(fopt) \ 58 if (OPTION("-ascii") || OPTION("-nobinary")) fopt = FO_ASCII; \ 59 else if (OPTION("-noascii") || OPTION("-binary")) fopt = FO_Binary; \ 60 else if (OPTION("-compress")) fopt = FO_Binary; \ 61 else if (OPTION("-nocompress")) fopt = FO_NoCompress 78 vtkSmartPointer<vtkPointSet>
ReadPointSet(
const char *fname,
bool exit_on_failure =
true);
89 vtkSmartPointer<vtkPointSet>
ReadPointSet(
const char *fname,
FileOption &fopt,
bool exit_on_failure =
true);
97 vtkSmartPointer<vtkPolyData>
ReadPolyData(
const char *fname,
bool exit_on_failure =
true);
108 vtkSmartPointer<vtkPolyData>
ReadPolyData(
const char *fname,
FileOption &fopt,
bool exit_on_failure =
true);
159 vtkSmartPointer<vtkPointSet>
ReadPointSetTable(
const char *fname,
char sep =
',',
160 vtkPointSet *pointset =
nullptr);
170 char sep =
',',
bool ids =
true,
bool coords =
true);
211 vtkSmartPointer<vtkPolyData>
ReadDFS(
const char *fname);
219 bool WriteDFS(
const char *fname, vtkPolyData *polydata);
230 vtkSmartPointer<vtkPolyData>
ReadOFF(
const char *fname);
238 bool WriteOFF(
const char *fname, vtkPolyData *polydata);
243 #if MIRTK_IO_WITH_GIFTI 256 static vtkInformationStringKey *DATE();
259 static vtkInformationStringKey *USER_NAME();
262 static vtkInformationStringKey *SUBJECT_ID();
265 static vtkInformationStringKey *SURFACE_ID();
268 static vtkInformationStringKey *UNIQUE_ID();
271 static vtkInformationStringKey *NAME();
274 static vtkInformationStringKey *DESCRIPTION();
278 static vtkInformationDoubleKey *TIME_STEP();
281 static vtkInformationStringKey *DATA_SPACE();
284 static vtkInformationStringKey *ANATOMICAL_STRUCTURE_PRIMARY();
287 static vtkInformationStringKey *ANATOMICAL_STRUCTURE_SECONDARY();
290 static vtkInformationStringKey *GEOMETRIC_TYPE();
293 static vtkInformationStringKey *TOPOLOGICAL_TYPE();
296 static vtkInformationIntegerKey *INTENT_CODE();
299 static vtkInformationDoubleKey *INTENT_P1();
302 static vtkInformationDoubleKey *INTENT_P2();
305 static vtkInformationDoubleKey *INTENT_P3();
314 static vtkInformationStringKey *PROGRAM_PROVENANCE();
317 static vtkInformationStringKey *PROVENANCE();
323 static vtkInformationStringKey *PARENT_PROVENANCE();
328 static vtkInformationStringKey *WORKING_DIRECTORY();
334 static Array<vtkInformationKey *> KeysForFile();
337 static Array<vtkInformationKey *> KeysForDataArray(
int = -1);
340 static string Get(vtkInformation *, vtkInformationKey *);
352 vtkSmartPointer<vtkPoints> ReadGIFTICoordinates(
const char *fname,
353 vtkInformation *info =
nullptr,
354 bool errmsg =
false);
365 vtkSmartPointer<vtkCellArray> ReadGIFTITopology(
const char *fname,
366 vtkInformation *info =
nullptr,
367 bool errmsg =
false);
375 vtkSmartPointer<vtkPointData> ReadGIFTIPointData(
const char *fname,
376 bool errmsg =
false);
408 vtkSmartPointer<vtkPolyData> ReadGIFTI(
const char *fname,
409 vtkPolyData *surface =
nullptr,
410 bool errmsg =
false);
428 #endif // MIRTK_IO_WITH_GIFTI 432 #endif // MIRTK_PointSetIO_H vtkSmartPointer< vtkPolyData > ReadPolyData(const char *fname, bool exit_on_failure=true)
const char * DefaultExtension(vtkDataSet *)
Default extension for given data set.
bool WriteDFS(const char *fname, vtkPolyData *polydata)
string Get(const ParameterList ¶ms, string name)
Get parameter value from parameters list.
vtkSmartPointer< vtkPointSet > ReadPointSetTable(const char *fname, char sep=',', vtkPointSet *pointset=nullptr)
bool WriteOFF(const char *fname, vtkPolyData *polydata)
bool WriteTetGenPoly(const char *fname, vtkPolyData *polydata, const PointSet *holes=nullptr)
bool WritePointSet(const char *fname, vtkPointSet *pointset, FileOption fopt=FO_Default)
bool WriteTetGenNode(const char *fname, vtkPointSet *pointset)
bool WritePolyData(const char *fname, vtkPolyData *polydata, FileOption fopt=FO_Default)
vtkSmartPointer< vtkPolyData > ReadDFS(const char *fname)
FileOption
Enumeration of file type options.
vtkSmartPointer< vtkPointSet > ReadPointSet(const char *fname, bool exit_on_failure=true)
bool WriteTetGenSMesh(const char *fname, vtkPolyData *polydata, const PointSet *holes=nullptr)
vtkSmartPointer< vtkPolyData > ReadOFF(const char *fname)
bool WritePointSetTable(const char *fname, vtkPointSet *pointset, char sep=',', bool ids=true, bool coords=true)