Thanks @Ali Hashmi for help I am new to using Mathematica. I haven't come across a post that would answer this issue. I would like to identify the 2 dyes (based on intensity against all the dyes used) which make up each segment. So when I have all the channels in a merged image I can assign each segment a specific pseudocolor for each dye combination. So for example I want to color all segments in the merged image which have channel green and channel blue signals green. Have used the ImageHistogram function but have no idea how to tackle this on an individual segment basis. I have attached only 1 channel and a mask as Im limited to the amount of links I can upload. The mask was formed from the merged image of all the channels to segment into ROIs outside of Mathematica.


closed as unclear what you're asking by george2079, MarcoB, happy fish, m_goldberg, glS Apr 19 '17 at 10:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ if you use ImageData Mathematica will give you a list of tridimensional vectors. Each component rapresent the value of the intensity of a single channel per pixel. By writing Mean@ImageData["imagepath"][[1,1;;5]] the output will be once again a tridimensional vector whose components are the mean of the intensity of each channel in the first line from column1 to 5 $\endgroup$ – Alucard Feb 28 '17 at 2:22
  • 1
    $\begingroup$ For the application of colors to an image, look at the documentation for Colorize. $\endgroup$ – bill s Feb 28 '17 at 3:46
  • 1
    $\begingroup$ voting to close as I think he reposed basically the same thing here: mathematica.stackexchange.com/q/139362/2079 $\endgroup$ – george2079 Apr 17 '17 at 16:29

lets say you have the following channels: channel1, channel2 and channel3. Provided we have the binarized mask (segmentation of your cell) stored as mask then we can do the following:

intensity1 = ImageMeasurements[channel1,"MeanIntensity", Masking -> mask];

you can do the same for others. Or better map the list of channels as:

{intensity1,intensity2,intensity3} =
ImageMeasurements[#,"MeanIntensity", Masking -> mask]&/@{channel1,channel2,channel3}
  • $\begingroup$ Thanks Ali, I tried your code and got the intensity values across for each channel using the mask. Is there a way to average the intensity across all pixels which make up a segment within the image and then be make to get a histogram for each segment so you can which channels have the higher mean intensity for each segment you I can say channel 1 and channel 3 (as I can only have 2 channels per segment) are the channels within a segment in that image. Then I can assign a color like say green for a segment with channel 1 and channel3 and blue for channel 1 and channel 2. thanks for your help $\endgroup$ – doro_t Feb 28 '17 at 14:14
  • $\begingroup$ @doro_t from what I understand from your comment, did you get two values for the mean pixel intensity? The two values are the average intensities of all the pixels making up in the segment in the two channels. Can you please let me know clearly what you want? $\endgroup$ – Ali Hashmi Feb 28 '17 at 14:27
  • $\begingroup$ @doro_t because i don't understand you fully at the moment $\endgroup$ – Ali Hashmi Feb 28 '17 at 14:28
  • $\begingroup$ Thanks for your quick response. I only got one value back for each channel, 3 values in total in the output. I would like to find out which 2 dyes (based on highest overall intensities over the 3 dyes used) are found within a segment so then I can apply a pseudocolor to the segment so each segment in the image (when merged) can be given the same color. I thought the ImageHistogram function would be the easiest way to visual this so I could see which 2 dyes have the higher intensity within a segment. can I forward/upload the images to show you? $\endgroup$ – doro_t Feb 28 '17 at 15:26
  • $\begingroup$ @doro_t sure please update the question. Write specifically what you want in the question. Upload the images you have there and explain what you need step by step and I will be glad to help you. $\endgroup$ – Ali Hashmi Feb 28 '17 at 15:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.