imagej / imagej-ops

ImageJ Ops: "Write once, run anywhere" image processing
https://imagej.net/libs/imagej-ops
BSD 2-Clause "Simplified" License
89 stars 42 forks source link

ApplyConstantThreshold: Not thread-safe #382

Open dietzc opened 8 years ago

dietzc commented 8 years ago

From https://github.com/imagej/imagej-ops/blob/master/src/main/java/net/imagej/ops/special/hybrid/BinaryHybridCFI.java#L81 we see that Ops usually are thread-safe. However, https://github.com/imagej/imagej-ops/blob/master/src/main/java/net/imagej/ops/threshold/apply/ApplyConstantThreshold.java#L73 isn't. We can now override getIndependentInstance but this implies that all Ops which are using this Op have to override getIndependentInstance (and call it on their children,...).

Any ideas how we can make this smarter? Can the OpService help us here?

Christian

PS: In the particular case of ApplyConstantThreshold we could introduce a MapIIandConstantToII and all others RAI. Then we can use a BinaryMap in the ApplyConstantThreshold which also seems to be more correct in comparison to updating a parameter manually. What do you think @LeonYang5114 @ctrueden?

ctrueden commented 8 years ago

Haha yeah, @LeonYang5114 did mention how dirty that hack was.

I still haven't had time to think about this, though. Punting to the hackathon, unless I get to it sooner...