contrib/mul/vil3d/vil3d_crop.cxx
Go to the documentation of this file.
00001 // This is mul/vil3d/vil3d_crop.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author Ian Scott.
00008 //
00009 //-----------------------------------------------------------------------------
00010 
00011 #include "vil3d_crop.h"
00012 #include <vcl_cassert.h>
00013 
00014 vil3d_image_resource_sptr vil3d_crop(
00015   const vil3d_image_resource_sptr &src,
00016   unsigned i0, unsigned n_i,
00017   unsigned j0, unsigned n_j,
00018   unsigned k0, unsigned n_k)
00019 {
00020   return new vil3d_crop_image_resource(src, i0, n_i, j0, n_j, k0, n_k);
00021 }
00022 
00023 
00024 vil3d_crop_image_resource::vil3d_crop_image_resource(
00025   vil3d_image_resource_sptr const& gi,
00026   unsigned i0, unsigned n_i,
00027   unsigned j0, unsigned n_j,
00028   unsigned k0, unsigned n_k):
00029   src_(gi),
00030   i0_(i0),
00031   ni_(n_i),
00032   j0_(j0),
00033   nj_(n_j),
00034   k0_(k0),
00035   nk_(n_k)
00036 {
00037   assert(i0 + n_i <= src_->ni() &&
00038          j0 + n_j <= src_->nj() &&
00039          k0 + n_k <= src_->nk() );
00040 }
00041