I’ve recently gotten back to the PSF analysis project I’ve been working, off and on, the last couple of years.
My current problem is that I can’t figure out how to crop beads from different images and put them in one collection. If you look at the attached screen shot and link to work flow (with sample images) notice that I segment the beads (no problem), find their centroids, then create X/Y strings (Java Snippet) that define the ROI to crop, then feed the ROI strings into the cropper in a loop. The issue I am having is that every ROI is applied to every image (to create an N image by R rois output, many of them empty), where what I want is to only apply the ROI to the image it came from (to create a 1 by R output). Does anyone have advice on how to accomplish that?? I feel like I am missing something fairly simple.
Just quickly, from looking at your screenshot: you’re feeding the entire table into the cropper node in each iteration of the loop. You can probably solve your issue by using the Chunk Loop Start node to iterate row by row in chunks of 1 (followed by a regular Table Row to Variable node to create the required flow variables for the Cropper).
Hope that helps. I can follow up later with more elaborate examples if required.
I ended up putting the “Chunk Loop start” at the beginning of the workflow, just after the image reader, that seemed to work as the cropper loop was then run once for each image (with the correct ROIs), instead of having all images passed into the cropper loop at once and then all ROIs applied to each image.
In this case, there is not really a way around at least one loop since you are looking to apply the Image Cropper with individual settings for each input.
You could get rid of the nested loops by joining the output of the Java Snippet with the original input images (output of Image Reader) and adding that Chunk Loop around the Image Cropper that is fed the parameters from a “regular” Table Row to Variable node (see Segment_Beads_One_Loop.knwf (36.6 KB)). Loops tend to produce some overhead that you should minimize.