aimsdata 6.0.0
Neuroimaging data handling
baseFormats_mesh_d.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34/*
35 * Data reader class
36 */
37#ifndef AIMS_IO_BASEFORMATS_MESH_D_H
38#define AIMS_IO_BASEFORMATS_MESH_D_H
39
41#include <aims/io/meshR.h>
42#include <aims/io/meshW.h>
43#include <aims/io/povW.h>
46
47
48namespace aims
49{
50
51 // MESH
52
53 template<int D, typename T>
57
58
59 template<int D, class T>
60 bool MeshFormat<D,T>::read( const std::string & filename,
62 const carto::AllocatorContext & /*context*/,
63 carto::Object options )
64 {
65 int frame = -1;
66 options->getProperty( "frame", frame );
67 MeshReader<D,T> r( filename );
68 r.read( obj, frame );
69 return( true );
70 }
71
72 template<int D, class T> bool
73 MeshFormat<D,T>::write( const std::string & filename,
74 const AimsTimeSurface<D,T> & obj,
75 carto::Object options )
76 {
77 bool ascii = false;
78 try
79 {
80 if( !options.isNull() )
81 {
82 carto::Object aso = options->getProperty( "ascii" );
83 if( !aso.isNull() )
84 ascii = (bool) aso->getScalar();
85 }
86 }
87 catch( ... )
88 {
89 }
90 MeshWriter<D,T> r( filename, ascii );
91 r.write( obj );
92 return( true );
93 }
94
95 // POV
96
97 template<int D>
101
102
103 template<int D>
104 bool PovFormat<D>::read( const std::string &,
106 const carto::AllocatorContext &, carto::Object )
107 {
108 return( false );
109 }
110
111 template<int D>
112 bool PovFormat<D>::write( const std::string & filename,
114 {
115 PovWriter<D> r( filename );
116 r.write( obj );
117 return( true );
118 }
119
120
121 // WAVEFRONT
122
123 template<int D, typename T>
127
128
129 template<int D, typename T>
130 bool WavefrontMeshFormat<D, T>::read( const std::string & filename,
132 const carto::AllocatorContext & context,
133 carto::Object options )
134 {
135 WavefrontMeshReader<D, T> r( filename );
136 r.read( obj, context, options );
137 return true;
138 }
139
140 template<int D, typename T>
141 bool WavefrontMeshFormat<D, T>::write( const std::string & filename,
142 const AimsTimeSurface<D, T> & obj,
143 carto::Object options )
144 {
145 WavefrontMeshWriter<D, T> r( filename );
146 r.write( obj, options );
147 return true;
148 }
149
150}
151
152
153#endif
The template class to manage a mesh with time if needed.
Definition surface.h:317
virtual bool read(const std::string &filename, AimsTimeSurface< D, T > &obj, const carto::AllocatorContext &context, carto::Object options)
virtual bool write(const std::string &filename, const AimsTimeSurface< D, T > &vol, carto::Object options=carto::none())
Mesh format readers for mesh objects.
Definition meshR.h:59
void read(AimsTimeSurface< D, T > &thing, int frame=-1)
Definition meshR.h:103
Mesh format writer for mesh objects.
Definition meshW.h:54
void write(const AimsTimeSurface< D, T > &thing)
Definition meshW.h:99
virtual bool write(const std::string &filename, const AimsTimeSurface< D, Void > &vol, carto::Object options=carto::none())
virtual bool read(const std::string &filename, AimsTimeSurface< D, Void > &obj, const carto::AllocatorContext &context, carto::Object options)
POV (http://www.povray.org) format writer for mesh objects.
Definition povW.h:53
void write(const AimsTimeSurface< D, T > &thing)
Definition povW.h:93
virtual bool write(const std::string &filename, const AimsTimeSurface< D, T > &vol, carto::Object options=carto::none())
virtual bool read(const std::string &filename, AimsTimeSurface< D, T > &obj, const carto::AllocatorContext &context, carto::Object options)
void read(AimsTimeSurface< D, T > &thing, const carto::AllocatorContext &context, carto::Object options)
void write(const AimsTimeSurface< D, T > &thing, carto::Object options=carto::none())
bool isNull() const
The class for EcatSino data write operation.