VIGRA - VIGRA: vigra/seededregiongrowing3d.hxx Source File

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

# vigra/seededregiongrowing3d.hxx

    00001 /************************************************************************/
    00002 /*                                                                      */
    00003 /*     Copyright 2003-2007 by Kasim Terzic, Christian-Dennis Rahn       */
    00004 /*                        and Ullrich Koethe                            */
    00005 /*       Cognitive Systems Group, University of Hamburg, Germany        */
    00006 /*                                                                      */
    00007 /*    This file is part of the VIGRA computer vision library.           */
    00008 /*    ( Version 1.6.0, Aug 13 2008 )                                    */
    00009 /*    The VIGRA Website is                                              */
    00010 /*        http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/      */
    00011 /*    Please direct questions, bug reports, and contributions to        */
    00012 /*        ullrich.koethe@iwr.uni-heidelberg.de    or                    */
    00013 /*        vigra@informatik.uni-hamburg.de                               */
    00014 /*                                                                      */
    00015 /*    Permission is hereby granted, free of charge, to any person       */
    00016 /*    obtaining a copy of this software and associated documentation    */
    00017 /*    files (the "Software"), to deal in the Software without           */
    00018 /*    restriction, including without limitation the rights to use,      */
    00019 /*    copy, modify, merge, publish, distribute, sublicense, and/or      */
    00020 /*    sell copies of the Software, and to permit persons to whom the    */
    00021 /*    Software is furnished to do so, subject to the following          */
    00022 /*    conditions:                                                       */
    00023 /*                                                                      */
    00024 /*    The above copyright notice and this permission notice shall be    */
    00025 /*    included in all copies or substantial portions of the             */
    00026 /*    Software.                                                         */
    00027 /*                                                                      */
    00028 /*    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND    */
    00029 /*    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES   */
    00030 /*    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND          */
    00031 /*    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT       */
    00032 /*    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,      */
    00033 /*    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING      */
    00034 /*    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR     */
    00035 /*    OTHER DEALINGS IN THE SOFTWARE.                                   */
    00036 /*                                                                      */
    00037 /************************************************************************/
    00038
    00039 #ifndef VIGRA_SEEDEDREGIONGROWING_3D_HXX
    00040 #define VIGRA_SEEDEDREGIONGROWING_3D_HXX
    00041
    00042 #include <vector>
    00043 #include <stack>
    00044 #include <queue>
    00045 #include "utilities.hxx"
    00046 #include "stdimage.hxx"
    00047 #include "stdimagefunctions.hxx"
    00048 #include "seededregiongrowing.hxx"
    00049 #include "multi_pointoperators.hxx"
    00050
    00051 namespace vigra {
    00052
    00053 namespace detail {
    00054
    00055 template <class COST, class Diff_type>
    00056 class SeedRgVoxel
    00057 {
    00058 public:
    00059     Diff_type location_, nearest_;
    00060     COST cost_;
    00061     int count_;
    00062     int label_;
    00063     int dist_;
    00064
    00065     SeedRgVoxel()
    00066     //: location_(0,0,0), nearest_(0,0,0), cost_(0), count_(0), label_(0)
    00067     {
    00068         location_ = Diff_type(0,0,0);
    00069         nearest_ = Diff_type(0,0,0);
    00070         cost_ = 0;
    00071         count_ = 0;
    00072         label_ = 0;
    00073     }
    00074
    00075     SeedRgVoxel(Diff_type const & location, Diff_type const & nearest,
    00076                 COST const & cost, int const & count, int const & label)
    00077     : location_(location), nearest_(nearest),
    00078       cost_(cost), count_(count), label_(label)
    00079     {
    00080         int dx = location_[0] - nearest_[0];
    00081         int dy = location_[1] - nearest_[1];
    00082         int dz = location_[2] - nearest_[2];
    00083         dist_ = dx * dx + dy * dy + dz * dz;
    00084     }
    00085
    00086     void set(Diff_type const & location, Diff_type const & nearest,
    00087              COST const & cost, int const & count, int const & label)
    00088     {
    00089         location_ = location;
    00090         nearest_ = nearest;
    00091         cost_ = cost;
    00092         count_ = count;
    00093         label_ = label;
    00094
    00095         int dx = location_[0] - nearest_[0];
    00096         int dy = location_[1] - nearest_[1];
    00097         int dz = location_[2] - nearest_[2];
    00098         dist_ = dx * dx + dy * dy + dz * dz;
    00099     }
    00100
    00101     struct Compare
    00102     {
    00103         // must implement > since priority_queue looks for largest element
    00104         bool operator()(SeedRgVoxel const & l,
    00105                         SeedRgVoxel const & r) const
    00106         {
    00107             if(r.cost_ == l.cost_)
    00108             {
    00109                 if(r.dist_ == l.dist_) return r.count_ < l.count_;
    00110
    00111                 return r.dist_ < l.dist_;
    00112             }
    00113
    00114             return r.cost_ < l.cost_;
    00115         }
    00116         bool operator()(SeedRgVoxel const * l,
    00117                         SeedRgVoxel const * r) const
    00118         {
    00119             if(r->cost_ == l->cost_)
    00120             {
    00121                 if(r->dist_ == l->dist_) return r->count_ < l->count_;
    00122
    00123                 return r->dist_ < l->dist_;
    00124             }
    00125
    00126             return r->cost_ < l->cost_;
    00127         }
    00128     };
    00129
    00130     struct Allocator
    00131     {
    00132         ~Allocator()
    00133         {
    00134             while(!freelist_.empty())
    00135             {
    00136                 delete freelist_.top();
    00137                 freelist_.pop();
    00138             }
    00139         }
    00140
    00141         SeedRgVoxel * create(Diff_type const & location, Diff_type const & nearest,
    00142                              COST const & cost, int const & count, int const & label)
    00143         {
    00144             if(!freelist_.empty())
    00145             {
    00146                 SeedRgVoxel * res = freelist_.top();
    00147                 freelist_.pop();
    00148                 res->set(location, nearest, cost, count, label);
    00149                 return res;
    00150             }
    00151
    00152             return new SeedRgVoxel(location, nearest, cost, count, label);
    00153         }
    00154
    00155         void dismiss(SeedRgVoxel * p)
    00156         {
    00157             freelist_.push(p);
    00158         }
    00159
    00160         std::stack<SeedRgVoxel<COST,Diff_type> *> freelist_;
    00161     };
    00162 };
    00163
    00164 } // namespace detail
    00165
    00166 /** \addtogroup SeededRegionGrowing
    00167     Region segmentation and voronoi tesselation
    00168 */
    00169 //@{
    00170
    00171 /********************************************************/
    00172 /*                                                      */
    00173 /*                    seededRegionGrowing3D             */
    00174 /*                                                      */
    00175 /********************************************************/
    00176
    00177 /** \brief Three-dimensional Region Segmentation by means of Seeded Region Growing.
    00178
    00179     This algorithm implements seeded region growing as described in
    00180
    00181     The seed image is a partly segmented multi-dimensional array which contains uniquely
    00182     labeled regions (the seeds) and unlabeled voxels (the candidates, label 0).
    00183     Seed regions can be as large as you wish and as small as one voxel. If
    00184     there are no candidates, the algorithm will simply copy the seed array
    00185     into the output array. Otherwise it will aggregate the candidates into
    00186     the existing regions so that a cost function is minimized. This
    00187     works as follows:
    00188
    00189     <ol>
    00190
    00191     <li> Find all candidate pixels that are 6-adjacent to a seed region.
    00192     Calculate the cost for aggregating each candidate into its adajacent region
    00193     and put the candidates into a priority queue.
    00194
    00195     <li> While( priority queue is not empty)
    00196
    00197         <ol>
    00198
    00199         <li> Take the candidate with least cost from the queue. If it has not
    00200         already been merged, merge it with it's adjacent region.
    00201
    00202         <li> Put all candidates that are 4-adjacent to the pixel just processed
    00203         into the priority queue.
    00204
    00205         </ol>
    00206
    00207     </ol>
    00208
    00209     If <tt>SRGType == CompleteGrow</tt> (the default), this algorithm will
    00210     produce a complete 6-connected tesselation of the array.
    00211     Other grow types (such as keeping contours for watersheds) are currently not
    00212     supported
    00213
    00214     The cost is determined jointly by the source array and the
    00215     region statistics functor. The source array contains feature values for each
    00216     pixel which will be used by the region statistics functor to calculate and
    00217     update statistics for each region and to calculate the cost for each
    00218     candidate. The <TT>RegionStatisticsArray</TT> must be compatible to the
    00219     \ref ArrayOfRegionStatistics functor and contains an <em> array</em> of
    00220     statistics objects for each region. The indices must correspond to the
    00221     labels of the seed regions. The statistics for the initial regions must have
    00222     been calculated prior to calling <TT>seededRegionGrowing3D()</TT>
    00223
    00224     For each candidate
    00225     <TT>x</TT> that is adjacent to region <TT>i</TT>, the algorithm will call
    00226     <TT>stats[i].cost(as(x))</TT> to get the cost (where <TT>x</TT> is a <TT>SrcImageIterator</TT>
    00227     and <TT>as</TT> is
    00228     the SrcAccessor). When a candidate has been merged with a region, the
    00229     statistics are updated by calling <TT>stats[i].operator()(as(x))</TT>. Since
    00230     the <TT>RegionStatisticsArray</TT> is passed by reference, this will overwrite
    00231     the original statistics.
    00232
    00233     If a candidate could be merged into more than one regions with identical
    00234     cost, the algorithm will favour the nearest region. If, at any point in the algorithm,
    00235     the cost of the current candidate exceeds the optional <tt>max_cost</tt> value (which defaults to
    00236     <tt>-1</tt>), region growing is aborted, and all voxels not yet assigned to a region
    00237     remain unlabeled.
    00238
    00239     In some cases, the cost only depends on the feature value of the current
    00240     voxel. Then the update operation will simply be a no-op, and the <TT>cost()</TT>
    00241     function returns its argument. This behavior is implemented by the
    00242     \ref SeedRgDirectValueFunctor.
    00243
    00244     <b> Declarations:</b>
    00245
    00246     pass arguments explicitly:
    00247     \code
    00248     namespace vigra {
    00249         template <class SrcImageIterator, class Diff_type, class SrcAccessor,
    00250                   class SeedImageIterator, class SeedAccessor,
    00251                   class DestImageIterator, class DestAccessor,
    00252                   class RegionStatisticsArray, class CostThresholdType >
    00253         void seededRegionGrowing3D(SrcImageIterator srcul, Diff_type shape,
    00254                                  SrcAccessor as,
    00255                                  SeedImageIterator seedsul, SeedAccessor aseeds,
    00256                                  DestImageIterator destul, DestAccessor ad,
    00257                                  RegionStatisticsArray & stats,
    00258                                  CostThresholdType max_cost = -1.0,
    00259                                  const SRGType srgType == CompleteGrow);
    00260
    00261         template <class SrcImageIterator, class Diff_type, class SrcAccessor,
    00262                   class SeedImageIterator, class SeedAccessor,
    00263                   class DestImageIterator, class DestAccessor,
    00264                   class RegionStatisticsArray>
    00265         void seededRegionGrowing3D(SrcImageIterator srcul, Diff_type shape,
    00266                                  SrcAccessor as,
    00267                                  SeedImageIterator seedsul, SeedAccessor aseeds,
    00268                                  DestImageIterator destul, DestAccessor ad,
    00269                                  RegionStatisticsArray & stats,
    00270                                  const SRGType srgType == CompleteGrow);
    00271
    00272        }
    00273     \endcode
    00274
    00275     use argument objects in conjunction with \ref ArgumentObjectFactories :
    00276     \code
    00277     namespace vigra {
    00278             template <class SrcImageIterator, class Shape, class SrcAccessor,
    00279                   class SeedImageIterator, class SeedAccessor,
    00280                   class DestImageIterator, class DestAccessor,
    00281                   class RegionStatisticsArray, class CostThresholdType>
    00282             void
    00283             seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> img1,
    00284                             pair<SeedImageIterator, SeedAccessor> img3,
    00285                             pair<DestImageIterator, DestAccessor> img4,
    00286                             RegionStatisticsArray & stats,
    00287                             CostThresholdType max_cost = -1.0,
    00288                             const SRGType srgType == CompleteGrow);
    00289
    00290             template <class SrcImageIterator, class Shape, class SrcAccessor,
    00291                   class SeedImageIterator, class SeedAccessor,
    00292                   class DestImageIterator, class DestAccessor,
    00293                   class RegionStatisticsArray>
    00294             void
    00295             seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> img1,
    00296                             pair<SeedImageIterator, SeedAccessor> img3,
    00297                             pair<DestImageIterator, DestAccessor> img4,
    00298                             RegionStatisticsArray & stats,
    00299                             const SRGType srgType == CompleteGrow);
    00300     }
    00301     \endcode
    00302
    00303 */
    00304 doxygen_overloaded_function(template <...> void seededRegionGrowing3D)
    00305
    00306 template <class SrcImageIterator, class Diff_type, class SrcAccessor,
    00307           class SeedImageIterator, class SeedAccessor,
    00308           class DestImageIterator, class DestAccessor,
    00309           class RegionStatisticsArray, class CostThresholdType>
    00310 void seededRegionGrowing3D(SrcImageIterator srcul, Diff_type shape,
    00311                          SrcAccessor as,
    00312                          SeedImageIterator seedsul, SeedAccessor aseeds,
    00313                          DestImageIterator destul, DestAccessor ad,
    00314                          RegionStatisticsArray & stats, CostThresholdType max_cost,
    00315                          const SRGType srgType)
    00316 {
    00317     SrcImageIterator srclr = srcul + shape;
    00318     //int w = srclr.x - srcul.x;
    00319     int w = shape[0];
    00320     //int h = srclr.y - srcul.y;
    00321     int h = shape[1];
    00322     //int d = srclr.z - srcul.z;
    00323     int d = shape[2];
    00324     int count = 0;
    00325
    00326     SrcImageIterator isy = srcul, isx = srcul, isz = srcul;  // iterators for the src image
    00327
    00328     typedef typename RegionStatisticsArray::value_type RegionStatistics;
    00329     typedef typename PromoteTraits<typename RegionStatistics::cost_type, CostThresholdType>::Promote CostType;
    00330     typedef detail::SeedRgVoxel<CostType, Diff_type> Voxel;
    00331
    00332     typename Voxel::Allocator allocator;
    00333
    00334     typedef std::priority_queue< Voxel *,
    00335                                  std::vector<Voxel *>,
    00336                                  typename Voxel::Compare >  SeedRgVoxelHeap;
    00337     typedef MultiArray<3, int> IVolume;
    00338
    00339     // copy seed image in an image with border
    00340     Diff_type regionshape = shape + Diff_type(2,2,2);
    00341     IVolume regions(regionshape);
    00342     MultiIterator<3,int> ir = regions.traverser_begin();
    00343     ir = ir + Diff_type(1,1,1);
    00344
    00345     //IVolume::Iterator iry, irx, irz;
    00346     MultiIterator<3,int> iry, irx, irz;
    00347
    00348     //initImageBorder(destImageRange(regions), 1, SRGWatershedLabel);
    00349     initMultiArrayBorder(destMultiArrayRange(regions), 1, SRGWatershedLabel);
    00350
    00351     copyMultiArray(seedsul, Diff_type(w,h,d), aseeds, ir, AccessorTraits<int>::default_accessor()/* vigra::StandardValueAccessor<int>*/);
    00352
    00353     // allocate and init memory for the results
    00354
    00355     SeedRgVoxelHeap pheap;
    00356     int cneighbor;
    00357
    00358     static const Diff_type dist[] = { Diff_type(-1, 0, 0), Diff_type( 0,-1, 0),
    00359                                       Diff_type( 1, 0, 0), Diff_type( 0, 1, 0),
    00360                                       Diff_type( 0, 0,-1), Diff_type( 0, 0, 1) };
    00361
    00362     Diff_type pos(0,0,0);
    00363
    00364     for(isz=srcul, irz=ir, pos[2]=0; pos[2]<d;
    00365             pos[2]++, isz.dim2()++, irz.dim2()++)
    00366     {
    00367         //std::cerr << "Z = " << pos[2] << std::endl;
    00368
    00369         for(isy=isz, iry=irz, pos[1]=0; pos[1]<h;
    00370             pos[1]++, isy.dim1()++, iry.dim1()++)
    00371         {
    00372             //std::cerr << "Y = " << pos[1] << std::endl;
    00373
    00374             for(isx=isy, irx=iry, pos[0]=0; pos[0]<w;
    00375                 pos[0]++, isx.dim0()++, irx.dim0()++)
    00376             {
    00377                 //std::cerr << "X = " << pos[0] << std::endl;
    00378
    00379                 if(*irx == 0)
    00380                 {
    00381                     // find candidate pixels for growing and fill heap
    00382                     for(int i=0; i<6; i++)
    00383                     {
    00384                         cneighbor = *(irx + dist[i]);
    00385                         if(cneighbor > 0)
    00386                         {
    00387                             CostType cost = stats[cneighbor].cost(as(isx));
    00388
    00389                             Voxel * voxel =
    00390                                 allocator.create(pos, pos+dist[i], cost, count++, cneighbor);
    00391                             pheap.push(voxel);
    00392                         }
    00393                     }
    00394                 }
    00395             }
    00396         }
    00397     }
    00398
    00399     // perform region growing
    00400     while(pheap.size() != 0)
    00401     {
    00402         Voxel * voxel = pheap.top();
    00403         pheap.pop();
    00404
    00405         if(max_cost > NumericTraits<CostThresholdType>::zero() && voxel->cost_ > max_cost) break;
    00406
    00407         Diff_type pos = voxel->location_;
    00408         Diff_type nearest = voxel->nearest_;
    00409         int lab = voxel->label_;
    00410
    00411         allocator.dismiss(voxel);
    00412
    00413         irx = ir + pos;
    00414         isx = srcul + pos;
    00415
    00416         if(*irx) // already labelled region / watershed?
    00417             continue;
    00418
    00419         if(srgType == KeepContours)
    00420         {
    00421             for(int i=0; i<6; i++)
    00422             {
    00423                 cneighbor = * (irx + dist[i]);
    00424                 if((cneighbor>0) && (cneighbor != lab))
    00425                 {
    00426                     lab = SRGWatershedLabel;
    00427                     break;
    00428                 }
    00429             }
    00430         }
    00431
    00432         *irx = lab;
    00433
    00434         if((srgType != KeepContours) || (lab > 0))
    00435         {
    00436             // update statistics
    00437             stats[*irx](as(isx));
    00438
    00439             // search neighborhood
    00440             // second pass: find new candidate pixels
    00441             for(int i=0; i<6; i++)
    00442             {
    00443                 if(*(irx + dist[i]) == 0)
    00444                 {
    00445                     CostType cost = stats[lab].cost(as(isx, dist[i]));
    00446
    00447                     Voxel * new_voxel =
    00448                         allocator.create(pos+dist[i], nearest, cost, count++, lab);
    00449                     pheap.push(new_voxel);
    00450                 }
    00451             }
    00452         }
    00453     }
    00454
    00455     // write result
    00456     transformMultiArray(ir, Diff_type(w,h,d), AccessorTraits<int>::default_accessor()/* regions.accessor()*/, destul, ad,
    00457                         detail::UnlabelWatersheds());
    00458 }
    00459 /*
    00460 template <class SrcImageIterator, class SrcAccessor,
    00461           class SeedImageIterator, class SeedAccessor,
    00462           class DestImageIterator, class DestAccessor,
    00463           class RegionStatisticsArray>
    00464 inline void
    00465 seededRegionGrowing3D(SrcImageIterator srcul,
    00466                     SrcImageIterator srclr, SrcAccessor as,
    00467                     SeedImageIterator seedsul, SeedAccessor aseeds,
    00468                     DestImageIterator destul, DestAccessor ad,
    00469                     RegionStatisticsArray & stats)
    00470 {
    00471     seededRegionGrowing3D(srcul, srclr, as,
    00472                         seedsul, aseeds,
    00473                         destul, ad,
    00474                         stats, CompleteGrow);
    00475 }*/
    00476 /*
    00477 template <class SrcImageIterator, class SrcAccessor,
    00478           class SeedImageIterator, class SeedAccessor,
    00479           class DestImageIterator, class DestAccessor,
    00480           class RegionStatisticsArray>
    00481 inline void
    00482 seededRegionGrowing3D(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> img1,
    00483                     pair<SeedImageIterator, SeedAccessor> img3,
    00484                     pair<DestImageIterator, DestAccessor> img4,
    00485                     RegionStatisticsArray & stats,
    00486                     SRGType srgType)
    00487 {
    00488     seededRegionGrowing3D(img1.first, img1.second, img1.third,
    00489                         img3.first, img3.second,
    00490                         img4.first, img4.second,
    00491                         stats, srgType);
    00492 }
    00493
    00494 template <class SrcImageIterator, class SrcAccessor,
    00495           class SeedImageIterator, class SeedAccessor,
    00496           class DestImageIterator, class DestAccessor,
    00497           class RegionStatisticsArray>
    00498 inline void
    00499 seededRegionGrowing3D(triple<SrcImageIterator, SrcImageIterator, SrcAccessor> img1,
    00500                     pair<SeedImageIterator, SeedAccessor> img3,
    00501                     pair<DestImageIterator, DestAccessor> img4,
    00502                     RegionStatisticsArray & stats)
    00503 {
    00504     seededRegionGrowing3D(img1.first, img1.second, img1.third,
    00505                         img3.first, img3.second,
    00506                         img4.first, img4.second,
    00507                         stats, CompleteGrow);
    00508 }
    00509 */
    00510
    00511 template <class SrcImageIterator, class Diff_type, class SrcAccessor,
    00512           class SeedImageIterator, class SeedAccessor,
    00513           class DestImageIterator, class DestAccessor,
    00514           class RegionStatisticsArray, class CostThresholdType>
    00515 void seededRegionGrowing3D(SrcImageIterator srcul, Diff_type shape,
    00516                          SrcAccessor as,
    00517                          SeedImageIterator seedsul, SeedAccessor aseeds,
    00518                          DestImageIterator destul, DestAccessor ad,
    00519                          RegionStatisticsArray & stats, CostThresholdType max_cost)
    00520 {
    00521     seededRegionGrowing3D( srcul, shape, as, seedsul, aseeds, destul, ad, stats, max_cost, CompleteGrow);
    00522 }
    00523
    00524 template <class SrcImageIterator, class Diff_type, class SrcAccessor,
    00525           class SeedImageIterator, class SeedAccessor,
    00526           class DestImageIterator, class DestAccessor,
    00527           class RegionStatisticsArray >
    00528 void seededRegionGrowing3D(SrcImageIterator srcul, Diff_type shape,
    00529                          SrcAccessor as,
    00530                          SeedImageIterator seedsul, SeedAccessor aseeds,
    00531                          DestImageIterator destul, DestAccessor ad,
    00532                          RegionStatisticsArray & stats)
    00533 {
    00534     seededRegionGrowing3D( srcul, shape, as, seedsul, aseeds, destul, ad, stats, -1.0, CompleteGrow);
    00535 }
    00536
    00537 template <class SrcImageIterator, class Diff_type, class SrcAccessor,
    00538           class SeedImageIterator, class SeedAccessor,
    00539           class DestImageIterator, class DestAccessor,
    00540           class RegionStatisticsArray >
    00541 void seededRegionGrowing3D(SrcImageIterator srcul, Diff_type shape,
    00542                          SrcAccessor as,
    00543                          SeedImageIterator seedsul, SeedAccessor aseeds,
    00544                          DestImageIterator destul, DestAccessor ad,
    00545                          RegionStatisticsArray & stats, SRGType srgType)
    00546 {
    00547     seededRegionGrowing3D( srcul, shape, as, seedsul, aseeds, destul, ad, stats, -1.0, srgType);
    00548 }
    00549
    00550
    00551
    00552 template <class SrcImageIterator, class Shape, class SrcAccessor,
    00553           class SeedImageIterator, class SeedAccessor,
    00554           class DestImageIterator, class DestAccessor,
    00555           class RegionStatisticsArray>
    00556 inline void
    00557 seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> img1,
    00558                     pair<SeedImageIterator, SeedAccessor> img3,
    00559                     pair<DestImageIterator, DestAccessor> img4,
    00560                     RegionStatisticsArray & stats, int max_cost)
    00561 {
    00562     seededRegionGrowing3D(img1.first, img1.second, img1.third,
    00563                         img3.first, img3.second,
    00564                         img4.first, img4.second,
    00565                         stats, max_cost, CompleteGrow);
    00566 }
    00567
    00568 template <class SrcImageIterator, class Shape, class SrcAccessor,
    00569           class SeedImageIterator, class SeedAccessor,
    00570           class DestImageIterator, class DestAccessor,
    00571           class RegionStatisticsArray, class CostThresholdType>
    00572 inline void
    00573 seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> img1,
    00574                     pair<SeedImageIterator, SeedAccessor> img3,
    00575                     pair<DestImageIterator, DestAccessor> img4,
    00576                     RegionStatisticsArray & stats, CostThresholdType max_cost, const SRGType srgType)
    00577 {
    00578     seededRegionGrowing3D(img1.first, img1.second, img1.third,
    00579                         img3.first, img3.second,
    00580                         img4.first, img4.second,
    00581                         stats, max_cost, srgType);
    00582 }
    00583
    00584
    00585 template <class SrcImageIterator, class Shape, class SrcAccessor,
    00586           class SeedImageIterator, class SeedAccessor,
    00587           class DestImageIterator, class DestAccessor,
    00588           class RegionStatisticsArray>
    00589 inline void
    00590 seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> img1,
    00591                     pair<SeedImageIterator, SeedAccessor> img3,
    00592                     pair<DestImageIterator, DestAccessor> img4,
    00593                     RegionStatisticsArray & stats, const SRGType srgType)
    00594 {
    00595     seededRegionGrowing3D(img1.first, img1.second, img1.third,
    00596                         img3.first, img3.second,
    00597                         img4.first, img4.second,
    00598                         stats, -1.0, srgType);
    00599 }
    00600
    00601 template <class SrcImageIterator, class Shape, class SrcAccessor,
    00602           class SeedImageIterator, class SeedAccessor,
    00603           class DestImageIterator, class DestAccessor,
    00604           class RegionStatisticsArray>
    00605 inline void
    00606 seededRegionGrowing3D(triple<SrcImageIterator, Shape, SrcAccessor> img1,
    00607                     pair<SeedImageIterator, SeedAccessor> img3,
    00608                     pair<DestImageIterator, DestAccessor> img4,
    00609                     RegionStatisticsArray & stats)
    00610 {
    00611     seededRegionGrowing3D(img1.first, img1.second, img1.third,
    00612                         img3.first, img3.second,
    00613                         img4.first, img4.second,
    00614                         stats, -1.0, CompleteGrow);
    00615 }
    00616
    00617
    00618
    00619 } // namespace vigra
    00620
    00621 #endif // VIGRA_SEEDEDREGIONGROWING_HXX
    00622

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python VIGRA 1.6.0 (13 Aug 2008)