Getting Rois raw intensity

Hi all,

I am the initial stage user of ImageJ. Here I am having a problem, In case anyone could help out that is great.

I have an Rois in an Z-stack got from some masks. Now I want to pick the raw intensities of these ROIs from the raw image i.e. I need an image of same size (don’t want to crop it) with the raw intensity of the ROIs only. Is there a plugin or option to do this in ImageJ? Or should we write our own code to do so?
Basically other that ROIs pixels, rest have to become 0/1.

Here I am sharing the Roi file & my raw image file with the Rois in it.
RoiSet.zip (42.3 KB)

Below is the cropped image

Here is the cropped image,
Image_rois_cropped.zip (21.6 MB)

@lakshmi sorry that this has been left unanswered for so long.

The process of clearing all data outside your ROI is called masking. For any given ROI, you can clear all outside pixels (in the current plane) using Edit > Clear Outside.


In your case, having multiple ROIs over many planes in a stack, you can also take a different approach:

  1. Create a new black image with the same dimensions as your original image
  2. Using the ROI manager, fill all ROIs with white color (this is your mask)
  3. Using the Image Calculator, multiply the original image with your mask.

Below is a python script (to be run from the script editor) that automated step 1 and 2 from above:

# @ImagePlus imp

from ij import IJ
from ij.plugin.frame import RoiManager

def run():
    rm = RoiManager.getInstance()
    if not rm:
        print "Please first add some ROIs to the ROI Manager"
        return
    impMask = IJ.createImage("Mask", "8-bit grayscale-mode", imp.getWidth(), imp.getHeight(), imp.getNChannels(), imp.getNSlices(), imp.getNFrames())
    IJ.setForegroundColor(255, 255, 255)
    rm.runCommand(impMask,"Deselect")
    rm.runCommand(impMask,"Fill")
    impMask.show()

run()

Hope that helps.