[ImageJ-devel] Local Neighborhood stuff
Tobias Pietzsch
pietzsch at mpi-cbg.de
Mon Aug 20 08:19:50 CDT 2012
On 08/20/2012 02:50 PM, Jean-Yves Tinevez wrote:
> Hi Stephan
>
> Just to be sure I got your point:
>
> You mean that if we iterate over all the neighbohoods of a single final
> image in a multithreaded way, we might screw up with the unsafe
> implementations right? In a pseudo code, this:
>
> for (int i =0; i < nThreads, i++) {
> threads[i] = new Thread() {
>
> public void run() {
>
> for ( Neighborhood<T> n : chunks)
> for ( T t : n )
> ...
> ...
> ...
>
> would always fail with the unsafe implementation and always work with
> safe implementations? Right??
Hi Jean-Yves,
No. That would work in all cases, because the outer loop
for ( Neighborhood<T> n : chunks) uses one Cursor<Neighborhood<T>> and
those are just completely normal cursors.
What would be problematic would be something like:
for ( Neighborhood<T> n : chunks)
parallel( n );
void paralled( IterableInterval<T> iterable )
{
for (int i =0; i < nThreads, i++) {
threads[i] = new Thread() {
public void run() {
for ( T t : iterable )
...
}
because every thread would get the same Cursor<T> for the unsafe
variant.
best regards,
Tobias
More information about the ImageJ-devel
mailing list