00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __mitkImageIOFactory_h
00012 #define __mitkImageIOFactory_h
00013
00014 #include "mitkProcessObject.h"
00015 #include "mitkVolume.h"
00016 #include "mitkOoCGlobalSettings.h"
00017
00018 #if defined(MITK_CC_MSVC)
00019 #pragma warning(disable:4251)
00020 #endif
00021
00022 #define MITK_IMAGE_IO_READ 1
00023 #define MITK_IMAGE_IO_WRITE 2
00024
00029 class MITK_COMMON_API mitkImageIOFactory : public mitkProcessObject
00030 {
00031 public:
00032 MITK_TYPE(mitkImageIOFactory, mitkProcessObject)
00033
00034 virtual void PrintSelf(ostream &os);
00035
00036 mitkImageIOFactory(int mode);
00037
00038
00039 void SetFileName(const char* name);
00040 void SetFileName(const std::string & name);
00041
00042 void SetSpacings(float x, float y, float z)
00043 { m_VoxelSpacing[0] = x; m_VoxelSpacing[1] = y; m_VoxelSpacing[2] = z; }
00044
00045 void SetDimensions(int x, int y, int z)
00046 { m_Dimension[0] = x; m_Dimension[1] = y; m_Dimension[2] = z; }
00047
00048 void SetNumberOfChannels(unsigned int n)
00049 { m_NumberOfChannels = n; }
00050
00051 void SetDataType(int type)
00052 { m_DataType = type; }
00053
00054 void SetInput(mitkVolume* vol);
00055
00056 mitkVolume* GetOutput();
00057
00058 enum FileFormat{ BMP, JPEG, TIFF, IM0, DICOM, RAW, META, HDR, NETCDF, UNKNOWN };
00059
00060 FileFormat GetFileFormat();
00061
00062 #ifdef MITK_VER_OOC
00063 void SetOoCSupport(char const *diskPath=mitkOoCGlobalSettings::DiskCachePath, unsigned int bufSliceNum = mitkOoCGlobalSettings::BufferedSliceNumber, bool supportOoC = true);
00064
00065 protected:
00066 std::string m_DiskPath;
00067 unsigned int m_BufferedSliceNum;
00068 bool m_NeedOoC;
00069 #endif
00070
00071 protected:
00072 mitkImageIOFactory();
00073 virtual ~mitkImageIOFactory();
00074
00075 virtual bool Execute();
00076
00077 bool ReadFromFile();
00078 bool WriteToFile();
00079
00080 std::string GetFilenameName(const std::string& filename);
00081 std::string GetFilenameLastExtension(const std::string& filename);
00082 std::string GetFilenameWithoutLastExtension(const std::string& filename);
00083 bool FileIsDirectory(const char* name);
00084 bool FileExists(const char* filename, bool isFile = false);
00085
00086 mitkVolume* m_IOVolumePtr;
00087 int m_Mode;
00088 std::string m_Filename;
00089
00090
00091 float m_VoxelSpacing[3];
00092 int m_Dimension[3];
00093 unsigned int m_NumberOfChannels;
00094 int m_DataType;
00095
00096 private:
00097 mitkImageIOFactory(const mitkImageIOFactory&);
00098 void operator = (const mitkImageIOFactory&);
00099
00100 };
00101
00102 #endif
00103