00001
00002 #ifndef vil3d_gipl_format_h_
00003 #define vil3d_gipl_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012 #include <vil3d/vil3d_file_format.h>
00013 #include <vil/vil_stream.h>
00014
00015
00016
00017 class vil3d_gipl_format : public vil3d_file_format
00018 {
00019 public:
00020 vil3d_gipl_format();
00021
00022 virtual ~vil3d_gipl_format();
00023
00024 virtual vil3d_image_resource_sptr make_input_image(const char *) const;
00025
00026
00027
00028 virtual vil3d_image_resource_sptr make_output_image(const char* filename,
00029 unsigned ni,
00030 unsigned nj,
00031 unsigned nk,
00032 unsigned nplanes,
00033 enum vil_pixel_format) const;
00034
00035
00036
00037 virtual const char * tag() const {return "gipl";}
00038 };
00039
00040
00041
00042 class vil3d_gipl_image: public vil3d_image_resource
00043 {
00044 vil_smart_ptr<vil_stream> is_;
00045
00046
00047 vil_smart_ptr<vil_stream> os_;
00048
00049
00050 unsigned dim1_, dim2_, dim3_;
00051
00052
00053 unsigned nplanes_;
00054
00055
00056 float vox_width1_, vox_width2_, vox_width3_;
00057
00058 bool read_header(vil_stream *is);
00059 bool write_header(void);
00060
00061
00062 enum vil_pixel_format pixel_format_;
00063
00064
00065 char orientation_flag_;
00066
00067
00068 double min_val_, max_val_;
00069
00070
00071 double origin1_, origin2_, origin3_;
00072
00073 float interslice_gap_;
00074
00075 vil_streampos start_of_data_;
00076
00077 public:
00078 vil3d_gipl_image(vil_stream* os, unsigned);
00079 vil3d_gipl_image(vil_stream *);
00080
00081 #if 0
00082 vil3d_gipl_image(vil_stream* os,
00083 unsigned ni,
00084 unsigned nj,
00085 unsigned nk,
00086 unsigned nplanes,
00087 enum vil_pixel_format);
00088 #endif // 0
00089
00090 vil3d_gipl_image(vil_stream* os,
00091 unsigned ni,
00092 unsigned nj,
00093 unsigned nk,
00094 unsigned nplanes,
00095 enum vil_pixel_format format,
00096 float vox_width1=1.0,
00097 float vox_width2=1.0,
00098 float vox_width3=1.0,
00099 char orientation_flag=0,
00100 double min_val=0.0,
00101 double max_val=0.0,
00102 double origin1=0.0,
00103 double origin2=0.0,
00104 double origin3=0.0,
00105 float interslice_gap=0.0
00106 );
00107
00108 virtual ~vil3d_gipl_image();
00109
00110
00111
00112 virtual unsigned nplanes() const;
00113
00114
00115 virtual unsigned ni() const;
00116
00117
00118 virtual unsigned nj() const;
00119
00120
00121 virtual unsigned nk() const;
00122
00123
00124 virtual enum vil_pixel_format pixel_format() const;
00125
00126
00127
00128
00129 virtual bool set_voxel_size(float,float,float);
00130
00131
00132
00133
00134
00135 virtual vil3d_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
00136 unsigned j0, unsigned nj,
00137 unsigned k0, unsigned nk) const;
00138
00139
00140
00141
00142
00143
00144
00145 virtual bool put_view(const vil3d_image_view_base& im,
00146 unsigned i0, unsigned j0, unsigned k0);
00147
00148
00149
00150 virtual char const* file_format() const { return "gipl"; }
00151
00152
00153
00154 virtual bool get_property(char const* label, void* property_value = 0) const;
00155 #if 0
00156 bool put_view(const vil3d_image_view_base& im,
00157 unsigned i0=0, unsigned j0=0, unsigned k0=0);
00158 #endif // 0
00159 };
00160
00161 #endif