1 #ifndef array3dfloodfill_h 2 #define array3dfloodfill_h 53 void setOutsideValue(T val);
71 void setOutput(
int,
int,
int,
bool addseed);
73 int getNextWorkCompartment();
74 void returnCompartment(
int);
76 int getWorkCompartment(
int,
int,
int)
const;
123 template <
class T>
inline 128 , threshold_(threshold)
129 , aboveisovalue_(max)
130 , insideval_(
mUdf(T))
131 , use6neighbors_(true)
133 , sz0_(input.info().getSize(0))
134 , sz1_(input.info().getSize(1))
135 , sz2_(input.info().getSize(2))
159 for (
int idx=0; idx<nrcompartments; idx++ )
165 std::random_shuffle(
mVarLenArr(arr), arr+nrcompartments );
166 for (
int idx=0; idx<nrcompartments; idx++ )
171 template <
class T>
inline 179 template <
class T>
inline 186 template <
class T>
inline 194 template <
class T>
inline 201 template <
class T>
inline 204 if ( x0<0 || x0>=
sz0_ || x1<0 || x1>=
sz1_ || x2<0 || x2>=
sz2_ )
230 const T inputval =
input_.get( x0, x1, x2 );
237 output_.set( x0, x1, x2, val );
243 int seed[] = { x0, x1, x2 };
252 template <
class T>
inline 258 bool nothingleft =
true;
290 template <
class T>
inline 300 template <
class T>
inline 329 for (
int i=-1; i<=1; i++ )
331 for (
int j=-1; j<=1; j++ )
333 for (
int k=-1; k<=1; k++ )
335 const char nrzeros = !i + !j + !k;
340 setOutput( arrpos[0]+i, arrpos[1]+j, arrpos[2]+k,
Threads::ConditionVar compartmentlock_
Definition: array3dfloodfill.h:106
Is an object that faciliates many threads to wait for something to happen.
Definition: thread.h:108
int compsz1_
Definition: array3dfloodfill.h:88
Lock that permits multiple readers to lock the object at the same time, but it will not allow any rea...
Definition: thread.h:141
bool useinputval_
Definition: array3dfloodfill.h:81
#define od_int64
Definition: plftypes.h:36
int nrcomp2_
Definition: array3dfloodfill.h:89
#define mMaxNrComp
Definition: array3dfloodfill.h:24
~Array3DFloodfill()
Definition: array3dfloodfill.h:172
void addSeed(EM::SectionID, EM::SubID)
virtual bool shouldContinue()
int sz1_
Definition: array3dfloodfill.h:93
bool convReadToWriteLock()
int compsz0_
Definition: array3dfloodfill.h:86
int getPos(int idx) const
Definition: multidimstorage.h:310
od_int64 nrIterations() const
Definition: array3dfloodfill.h:67
Threads::ReadWriteLock lock_
Definition: array3dfloodfill.h:101
bool getIndex(int global_pos, IDX &) const
Definition: multidimstorage.h:536
void useInputValue(bool yn)
Definition: array3dfloodfill.h:58
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
Array3D< T > & output_
Definition: array3dfloodfill.h:113
Definition: array3dfloodfill.h:96
Given an input array and a threshold, we use flood fill to find all the locations with values less (o...
Definition: array3dfloodfill.h:46
void addSeed(int, int, int)
Definition: array3dfloodfill.h:195
Set of pointers to objects.
Definition: commontypes.h:32
ObjectSet< Compartment > compartments_
Definition: array3dfloodfill.h:105
void setOutput(int, int, int, bool addseed)
Definition: array3dfloodfill.h:202
Array3DImpl< bool > * isdefined_
Definition: array3dfloodfill.h:116
const T * getData() const
Definition: arraynd.h:55
void readLock()
No writers will be active.
void setInsideValue(T val)
Definition: array3dfloodfill.h:56
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
bool isEmpty() const
Definition: multidimstorage.h:254
#define mAllocVarLenArr(type, varnm, __size)
Definition: varlenarray.h:54
int sz2_
Definition: array3dfloodfill.h:94
int nrcomp1_
Definition: array3dfloodfill.h:87
T threshold_
Definition: array3dfloodfill.h:78
TypeSet< int > permutation_
Definition: array3dfloodfill.h:109
void remove(const IDX &index)
Definition: multidimstorage.h:484
T outsideval_
Definition: array3dfloodfill.h:83
int getWorkCompartment(int, int, int) const
Definition: array3dfloodfill.h:180
size_type size() const
Definition: typeset.h:254
int sz0_
Definition: array3dfloodfill.h:92
void use6Neighbors(bool yn)
Definition: array3dfloodfill.h:59
Array3DFloodfill(const Array3D< T > &input, T threshold, bool aboveisovalue, Array3D< T > &output)
Definition: array3dfloodfill.h:124
bool doWork(od_int64 start, od_int64 stop, int)
Definition: array3dfloodfill.h:301
#define mVarLenArr(varnm)
Definition: varlenarray.h:56
int nrcomp0_
Definition: array3dfloodfill.h:85
#define mClass(module)
Definition: commondefs.h:164
#define pErrMsg(msg)
Definition: errmsg.h:60
T get(int, int, int) const
Definition: arrayndimpl.h:610
int getNextWorkCompartment()
Definition: array3dfloodfill.h:253
MultiDimStorage< int > seeds_
Protected by lock_.
Definition: array3dfloodfill.h:102
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:153
T insideval_
Definition: array3dfloodfill.h:82
int compsz2_
Definition: array3dfloodfill.h:90
void addToNrDone(int64_t increment)
void set(int, int, int, T)
Definition: arrayndimpl.h:591
bool isAboveIsovalue() const
Definition: array3dfloodfill.h:63
int use6neighbors_
Definition: array3dfloodfill.h:80
void returnCompartment(int)
Definition: array3dfloodfill.h:291
bool aboveisovalue_
Definition: array3dfloodfill.h:79
Compartment()
Definition: array3dfloodfill.h:98
void setOutsideValue(T val)
Definition: array3dfloodfill.h:187
const Array3D< T > & input_
Not protected.
Definition: array3dfloodfill.h:111
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:118
int maxNrThreads() const
Definition: array3dfloodfill.h:66
bool isused_
Protected by compartmentlock_.
Definition: array3dfloodfill.h:100