I'd like to try my hand at porting some image processing algorithms from AForge.NET to Paint.NET plugins, but I'm concerned that the ROI work item segmentation scheme will adversely affect the algorithms (which, due to their complexity, I'd like to minimize changes to). So, for instance, connected components labeling will identify all of the black "blobs" in a black & white (binary) image where white is the background color, but the algorithm relies on building up some shared global state in the form of a disjoint set forest. Before I go down this rabbit hole, I'd like to know if ROI is going to be a showstopper.
My understanding of ROI is limited to (1) Paint.NET segments effects processing into multiple write regions which are scheduled in parallel, and (2) each round has read access to the entire image.
I'm thinking that for connected components labelling (the output of which is rectangles around each blob) that I could just block all but one of the ROI threads (via a Mutex), do the analysis on the one unblocked thread, then unblock/wake the locked threads to render the resulting (clipped) rectangles. I suppose I could host the data structure in the current AppDomain (i.e. as a static variable).
Does that sound reasonable? Am I missing anything (like, preferably, a synchronous PreRender API)?
Let me know if you need more details about what I'm trying to do.
Thanks,