ROI combine and split - lines, not rectangles?

imagej

#1

I have a moderately large (~400) set of line segment selections saved in the ROI manager. I’d like to duplicate and flip them horizontally add a mirror image of those line segments, and I can’t seem to find anything that will work.

I’ve tried selecting all of the ROIs and using OR (Combine), which creates a composite selection (which appears to be made up of rectangle ROIs, rather than lines) I can flip and translate. I then need to split these back into their original line segments, but when I use the Split tool, I get a set of a few thousand tiny rectangle ROIs instead of the original 400 lines.

Is there any way to preserve line segments when creating a composite ROI? Is there another approach to this I haven’t thought of? Thanks!


#2

Hi Jen,

If you could provide some image example of what you are trying to achieve, it would be really helpful.

In any case, if you want to flip each line horizontally arround its vertical middle axis (otherwise some additional steps might be involved) you can use the Edit > Selection > Scale… command with -1 as the x factor and 1 as the y factor, with the “centered” option marked.

If you only have line ROIs in the manager, you can run this little script to flip each one and add the flipped copy to the collection. The result is a “crosses” collection. I am not sure if this is the desired result.

n=roiManager("count");
for(i=0; i<n ; i++) {
	roiManager("select", i);
	run("Scale... ", "x=-1 y=1 centered");
	roiManager("add");
	}

Best,
Nico