Multi Plot tool from ROI Manager is doing weird things

line-profile
roi-manager
trackmate
roi
Tags: #<Tag:0x00007fd5401675e8> #<Tag:0x00007fd540166af8> #<Tag:0x00007fd540166878> #<Tag:0x00007fd5401666c0>

#1

Hi everyone!

I’m drawing lines and wanting to look at the distribution of intensity along them. I want to use the “Multi Plot” action from the ROI Manager rather than Analyze --> Plot Profile for each line because I’ve found it easier to script the Multi Plot action for large numbers of lines.

I’ve noticed that sometimes when using the"Multi Plot" option from the ROI Manager I get some results that don’t make sense. The graph that comes up looks okay, but when I select “List”, I sometimes get results where it will skip an ‘X’ column. Ex:

I’m confused why there would be no X1 Column. I’ve found this issue when I’ve scripted this process with a jython script as well as when I just manually draw ~10 lines. The number of lines I drew and added to the ROI Manager is equal to the number of ‘Y’ columns.

Please let me know if anyone else has this issue or if someone knows what this might mean?


#2

@vanessa.king

Would you be able to share your script and maybe a sample image or two?

Thus far … I have not been able to recreate this issue after drawing manual lines and adding them to the ROI Manager. I am running on a Mac OS X Yosemite Version 10.10.5 using Fiji - ImageJ 2.0.-rc-61/1.51n; Java 1.8.0_66[64-bit]. What system are you running and what version of ImageJ/Fiji?

Are you sure to roiManager("Deselect"); to make sure you are selecting all the ROIs (not just a subset) before running ‘Multi Plot’? What are the exact steps you are taking (having the script will obviously help answer that)?

eta


#3

@etarena
Of course! Here are more detailed images of what I’m finding. This is the product of running my script.

And then, here is the “List” of the profiles, as well as a description of all elements if that helps. You’ll notice that a couple ‘X’ columns are missing. This happens several other times in the ~100 lines drawn.

Here is the script that is responsible for this. To explain, the ROIs are first generated in a previous jython script that utilizes TrackMate, then here I am taking the coordinates for the spots that TrackMate found, looking for the frames where there are at least 2 spots, then drawing a line between those spots. I have used my previous TrackMate script for other types of analyses (drawing circles instead of lines) with no issue.

#Uploading a previously made spot coordinates file and turning into array
t = coordinates[0]; 
for i in range(len(t)):
    t[i] = float(t[i])
x = coordinates[1]; 
for i in range(len(x)):
    x[i] = float(x[i]) * dimensions
y = coordinates[2];
for i in range(len(y)):
    y[i] = float(y[i]) * dimensions
m = coordinates[3];
for i in range(len(m)):
    m[i] = float(m[i])

rm = RoiManager.getInstance()
if (rm==None):
    rm = RoiManager()

#Goes through all spots
for i in range(len(t)):
    #Ignores lines of zeros between spot tracks
    if x[i] != 0:
	    #Goes through all spots again
	     for j in range(len(t)):
		    #Ignores lines of zeros between tracks
		    if x[j] !=0:
			    #Asks if there is another spot with the same time that isn't identical and hasn't been recorded yet
			    if (t[i] == t[j] and i < j):
				    #Sets position of image
				    imp.setPosition(2, 1, int(t[i])+1)
				    #Adds line ROI between the two spots
				    rm.addRoi(ij.gui.Line(x[i], y[i], x[j], y[j]))
rm.runCommand(imp,"Multi Plot");
rm.runCommand(imp, "List");

I then manually save the “List” data.

Here is an example of the same issue happening when done manually.

This doesn’t happen every time manually, however it does seem to happen every time I run my code thus far. My exact steps are:

  1. Open image
  2. Select Analyze > Tools > ROI Manager
  3. Draw line, select “Add”, repeat
  4. Select Multi Plot
  5. Select List
    I also tried this but selected “Deselect” just before selecting “Multi Plot” to the same result.

As for what I am running, I am running Mac OS X El Capitan Version 10.11.3. I’m using Fiji - Version 1.0, with Java 1.8.0_66 (64-bit)

Thank you for any suggestions you can provide in advance!


#4

Hi!

Has anyone seen this problem and knows the cause?
I am seeing the same this happen with X columns missing in random places and desperately need fixing :confused:

Thanks for your help


#5

@Wayne - I was unable to address this issue previously… any thoughts on this one?

Thank you!

eta


#6

Hi everyone. Just to update anyone who’s also looking at this issue, I never did find a solution to it. I ended up working around it by writing script to rewrite my own X columns instead.


#7

I agree that this behavior is truly confusing, but just noticed that this seems to be intended behavior: in the API documentation of the Plot#getResultsTable() method, it says:

Does not write the first x column if writeFirstXColumn is false. x columns equal to the first x column are never written, independent of writeFirstXColumn

I assume this was done to avoid repeated equal columns when all profiles have the same length, but it gets confusing when only some of them have the same length as the (arbitrary) first one. (@Wayne might be able to provide more background on this.)


#8

This bug is fixed in the latest ImageJ daily build (1.51q32). An X column is now only omitted when it has the same values as the first X column and all the profiles are same length.