cmtkVolumeIO.h

Go to the documentation of this file.
00001 /*
00002 //
00003 //  Copyright 1997-2009 Torsten Rohlfing
00004 //
00005 //  Copyright 2004-2011 SRI International
00006 //
00007 //  This file is part of the Computational Morphometry Toolkit.
00008 //
00009 //  http://www.nitrc.org/projects/cmtk/
00010 //
00011 //  The Computational Morphometry Toolkit is free software: you can
00012 //  redistribute it and/or modify it under the terms of the GNU General Public
00013 //  License as published by the Free Software Foundation, either version 3 of
00014 //  the License, or (at your option) any later version.
00015 //
00016 //  The Computational Morphometry Toolkit is distributed in the hope that it
00017 //  will be useful, but WITHOUT ANY WARRANTY; without even the implied
00018 //  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 //  GNU General Public License for more details.
00020 //
00021 //  You should have received a copy of the GNU General Public License along
00022 //  with the Computational Morphometry Toolkit.  If not, see
00023 //  <http://www.gnu.org/licenses/>.
00024 //
00025 //  $Revision: 2745 $
00026 //
00027 //  $LastChangedDate: 2011-01-14 14:22:47 -0800 (Fri, 14 Jan 2011) $
00028 //
00029 //  $LastChangedBy: torstenrohlfing $
00030 //
00031 */
00032 
00033 #ifndef __cmtkVolumeIO_h_included_
00034 #define __cmtkVolumeIO_h_included_
00035 
00036 #include <cmtkconfig.h>
00037 
00038 #include <Base/cmtkUniformVolume.h>
00039 #include <Base/cmtkAnatomicalOrientation.h>
00040 
00041 #include <IO/cmtkFileFormat.h>
00042 #include <IO/cmtkTypedStream.h>
00043 
00044 namespace
00045 cmtk
00046 {
00047 
00050 
00074 class VolumeIO 
00075 {
00076 public:
00078   typedef VolumeIO Self;
00079 
00081   static UniformVolume::SmartPtr Read( const char *path, const bool verbose = false );
00082 
00084   static UniformVolume::SmartPtr ReadGrid( const char *path, const bool verbose = false );
00085 
00087   static UniformVolume::SmartPtr ReadGridOriented( const char *path, const char* orientation, const bool verbose = false );
00088 
00090   static UniformVolume::SmartPtr ReadGridOriented( const char *path, const bool verbose = false )
00091   {
00092     return Self::ReadGridOriented( path, AnatomicalOrientation::ORIENTATION_STANDARD, verbose );
00093   }
00094 
00104   static UniformVolume::SmartPtr ReadOriented( const char *path, const char* orientation, const bool verbose = false );
00105 
00110   static UniformVolume::SmartPtr ReadOriented( const char *path, const bool verbose = false )
00111   {
00112     return Self::ReadOriented( path, AnatomicalOrientation::ORIENTATION_STANDARD, verbose );
00113   }
00114 
00121   static void Write( const UniformVolume& volume, const FileFormatID format, const char *path, const bool verbose = false );
00122 
00133   static void Write( const UniformVolume& volume, const char *pathAndFormat, const bool verbose = false );
00134 
00136   static void SetWriteCompressedOn()
00137   {
00138     Self::WriteCompressedOn = true;
00139   }
00140 
00142   static void SetWriteCompressedOff()
00143   {
00144     Self::WriteCompressedOn = false;
00145   }
00146 
00148   static bool GetWriteCompressed()
00149   {
00150     return Self::WriteCompressedOn;
00151   }
00152 
00153 private:
00155   static bool WriteCompressedOn;
00156 
00162   class Initializer
00163   {
00164   private:
00166     Initializer();
00167 
00169     static Initializer Instance;
00170   };
00171 };
00172 
00174 
00175 } // namespace cmtk
00176 
00177 #endif // #ifndef __cmtkVolumeIO_h_included_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines