def save_roi_set(imp=IJ.getImage()):
    img_dir, name = get_file_info()
    roi_dir = make_roi_dir(img_dir, name)
    roi_path = make_roi_path(roi_dir, name)
    rm = RoiManager().getInstance()
    rm.deselect()
    rm.runCommand("Save", roi_path)
    rm.runCommand("delete")
Example #2
0
def save_roi_set(imp):
    
    img_dir, name = get_file_info(imp)
    roi_path = make_roi_path(img_dir, name)
   
    rm = RoiManager().getInstance()

    rm.deselect()
    if roi_path is not None:
        rm.runCommand("Save",roi_path)
        rm.runCommand("delete")
Example #3
0
def save_roi_set(imp=IJ.getImage()):

    img_dir, name = get_file_info()
    roi_dir = make_roi_dir(img_dir, name)
    roi_path = make_roi_path(roi_dir, name)

    Roi.setColor(Color.blue)
    rm = RoiManager().getInstance()
    rm.deselect()
    rm.runCommand("Save", roi_path)

    ol = imp.getOverlay()
    if ol is None:
        ol = Overlay()
    for roi in rm.getRoisAsArray():
        ol.add(roi)
        imp.setOverlay(ol)

    rm.runCommand("delete")
    ol.setStrokeColor(Color.blue)
    Roi.setColor(Color.yellow)
Example #4
0
rm.reset()
rm.runCommand("Open", os.path.join(folder, "selected.zip"))

# rename the remaining ROIs so that VSI can deal with them
# i is the index within ROI Mgr. i+1 is the number given by VSI Reader

# get base name of ROIs
# searching the last 5 characters for the hashmark because there are usually 2 in the ROI name

oldname = rm.getName(0)
hashPos = oldname.find("#",-5) + 1
# print hashPos
basename = oldname[0:hashPos]
# print "Basename is " + basename

nROIs = rm.getCount()

for i in range(0, nROIs):
  roiNum = i + 1
  rm.select(i)
  rm.runCommand("Rename", basename + str(roiNum))
  rm.deselect()

rm.runCommand("Save", os.path.join(folder, "renamed.zip"))

# finally, user should select all the ROIs and click Extract Current Image
# and save a copy with the overlay of ROIs
# for serial sections, use a large thumbnail to make ROIs. 
# Re-open the "renamed" file and the 2nd series, activate ROIs on the other series image, adjust positions, RENAME TO SERIES 2 and extract