contrib/mul/vil3d/vil3d_new.h
Go to the documentation of this file.
00001 // This is mul/vil3d/vil3d_new.h
00002 #ifndef vil3d_new_h_
00003 #define vil3d_new_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Make a new image.
00010 
00011 #include <vil/vil_fwd.h> // for vil_stream
00012 #include <vil3d/vil3d_image_resource.h>
00013 #include <vil3d/vil3d_image_view.h>
00014 
00015 //: Make a new image of given format.
00016 // \relatesalso vil3d_image_resource
00017 vil3d_image_resource_sptr vil3d_new_image_resource(unsigned ni, unsigned nj, unsigned nk,
00018                                                   unsigned nplanes, vil_pixel_format format);
00019 
00020 
00021 //: Make a new image on disk.
00022 // \relatesalso vil3d_image_resource
00023 vil3d_image_resource_sptr vil3d_new_image_resource(const char* filename, unsigned ni, unsigned nj,
00024                                                    unsigned nk, unsigned nplanes,
00025                                                    vil_pixel_format format,
00026                                                    char const* file_format = 0);
00027 
00028 
00029 //: Create an image view whose i step is 1.
00030 template <class T>
00031 vil3d_image_view<T> vil3d_new_image_view_plane_k_j_i(unsigned ni, unsigned nj,
00032   unsigned nk, unsigned nplanes, T /*dummy*/)
00033 {
00034   vil_pixel_format fmt = vil_pixel_format_of(T());
00035   vil_memory_chunk_sptr chunk = new vil_memory_chunk(ni*nj*nk*nplanes*sizeof(T),
00036     vil_pixel_format_component_format(fmt));
00037   return vil3d_image_view<T>(chunk, reinterpret_cast<T *>(chunk->data()), ni, nj, nk,
00038     nplanes, 1, ni, ni*nj, ni*nj*nk);
00039 }
00040 
00041 #endif // vil3d_new_h_