# Overlap between two Line ROIs Classic List Threaded 2 messages Reply | Threaded
Open this post in threaded view
|

## Overlap between two Line ROIs

 Hi, Any help how to go about the following analysis is appreciated. I have two images. In each image, I  have a bunch of verticle straight lines. Now I would like to compute the number of total verticle lines overlapping with each other. If two lines from two images are 50% or more overlap then I consider one line is overlapping. Similarly, I would eventually compute how many such lines are overlapping between the two images. With ImageJ can draw lines, and export the lines co-ordinates. One logic is that - from ROI I need to create some sort of boundary for each line, then compute how many pixels in across two boundaries are overlapping, set the threshold for overlapping, and if that threshold is matched then I run a for loop to count each event of overlaps for each ROIs. How can I create the boundary and ask for pixel position match in imageJ. Any help is great! thank you -- Sent from: http://imagej.1557.x6.nabble.com/-- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

## Re: Overlap between two Line ROIs

 Dear pduw, You could try to threshold both images, run an "Analyze Particles...." on the first images and store the ROIs in the ROI manager. Next, use the Image Calculator XOR option to find the difference between the images. something like: overlap = 0; imageCalculator("XOR create", title, title2); selectWindow("Result of "+title); for (i = 0; i < roiManager("count"); i++) {  roiManager("Select", i);  run("Histogram");  wait(100);  Plot.getValues(x, y);  print (y, y);  if (y>= y)   overlap = overlap + 1;  selectWindow("Histogram of Result");  close(); } print(overlap); Best wishes Kees Dr Ir K.R. Straatman Advanced Imaging Facility Centre for Core Biotechnology Services University of Leicester www.le.ac.uk/advanced-imaging-facility -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html