// ----------------------------------------------------------------------- // growObject.cc: Grow a detected object down to a lower flux threshold. // ----------------------------------------------------------------------- // Copyright (C) 2006, Matthew Whiting, ATNF // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the // Free Software Foundation; either version 2 of the License, or (at your // option) any later version. // // Duchamp is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License // for more details. // // You should have received a copy of the GNU General Public License // along with Duchamp; if not, write to the Free Software Foundation, // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA // // Correspondence concerning Duchamp may be directed to: // Internet email: Matthew.Whiting [at] atnf.csiro.au // Postal address: Dr. Matthew Whiting // Australia Telescope National Facility, CSIRO // PO Box 76 // Epping NSW 1710 // AUSTRALIA // ----------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include using namespace PixelInfo; using namespace Statistics; namespace duchamp { void growObject(Detection &object, Cube &cube) { /// @details /// A function to grow an object (given by the Detection) by /// including neighbouring voxels out to some lower threshold than /// what was previously used in the detection. /// /// Each pixel has each of its neighbours examined, and if one of /// them is not in the object but above the growth threshold, it /// is added to the object. /// /// \param object Object to be grown. /// \param cube Necessary to see both the Param list, containing /// the growth threshold, and the actual array of pixel fluxes. if(cube.pars().getFlagGrowth()){ bool doGrowing; if(cube.pars().getFlagUserGrowthThreshold()) doGrowing = cube.pars().getGrowthThreshold() isInObj(cube.getSize(),false); bool flagAdj = cube.pars().getFlagAdjacent(); int threshS = int(cube.pars().getThreshS()); if(flagAdj) threshS = 1; int threshV = int(cube.pars().getThreshV()); std::vector voxlist = object.getPixelSet(); int origSize = voxlist.size(); long zero = 0; // std::vector::iterator vox; // for(vox=voxlist.begin();voxgetX() + vox->getY()*cube.getDimX() + // vox->getZ()*cube.getDimX()*cube.getDimY(); for(size_t i=0; i growthStats(cube.stats()); if(cube.pars().getFlagUserGrowthThreshold()) growthStats.setThreshold(cube.pars().getGrowthThreshold()); else growthStats.setThresholdSNR(cube.pars().getGrowthCut()); growthStats.setUseFDR(false); for(size_t i=0; i