Image too dark to see



I have reported earlier that images in the Classifier windows are too dark to see. afraser replied and says he is aware of the problem. I am wondering if you guys have figured out a good way to deal with it.
I tried to look into JAIImageReader, but couldn’t figure out where to adjust the brightness of the image.
I also manually stretched the images before loading into the database. The stretched images look nice in the classifier window, but when I select “Show Full Images of Selected Cells”, I found one channel is complete dark, while the other is fine. Have you seen this before?
CPAnalyst is a powerful and user-friendly tool, but now I can’t do anything without having a clear view of the images. Please help!

Sarah Hu


Hi Sarah,

Sorry for the late reply. For some reason I wasn’t alerted of your post.

I just looked at your last post and you said that you set “image format information” to “Y”. This tells the program that your image files are 12 bit and that it should rescale the values. You also mentioned using .pngs, however, which I’ve never heard of being 12 bit. Could you try leaving “image format information” blank and see if this helps any.

I have also never seen a case where one channel is rendered black unless the images themselves are of course black. Try:

  1. running classifier
  2. fetch some cells
  3. select one, right click (ctrl+click for mac), and view the image it was cropped from.
  4. switch to the console that was launched with CPA
  5. find the last set of images that were loaded (it will say “opening image file …/path/to/image/filename.png”)
  6. load those image channels using your filesystem or web browser, and confirm that they aren’t black or very dark.

In the meantime, I’ll take a look at the CPA code and try to figure out why the full images and the cropped images are appearing differently.



Thank you for the reply. I am using “N” for “Image Format Information” now, and it doesn’t make any difference. I converted the images to uint16 tif and it didn’t work either.
The images look noisy if read from Matlab directly (imread, and then imagesc), same in CellProfiler. But it is much darker in JPAnalyst, almost unable to see.

I know imagesc works as if stretching the images. How does JPAnalyst show a image, display 65535 as the brightest for a uint16, and leaving, for example, 100 dark? Then do I stretch every image before analyzing it in CellProfiler? But this way I lose the actual intensity information.

btw, I can’t see the image filename through the console. When I right click a image to see the full image, I see in console:

Select DISTINCT 102908_e_Per_Object.Nuclei_Location_CenterX,102908_e_Per_Object.Nuclei_Location_CenterY FROM 102908_e_Per_Object WHERE (ImageNumber=1 and ObjectNumber=7)

I will have to query the database for that ImageNumber to find the exact path and image name. Is there other way to do this?
I think being able to see the actual image name in CPA is very useful. Especially, when “Score All Image”, it is nice to know which image that image #1 corresponds to.



Unfortunately, I don’t think we’re going to be able to solve this problem in time. I’m the only dedicate software engineer on this project, and my efforts are currently concentrated on rewriting the application in Python. The new classifier is actually nearing completion now, so it’s hard for us to justify going back and working with the old code, when a newer shiny’er version will hopefully be out soon. Still, it’s a little strange to me that your images are too dark to work with. While I notice the difference on the different projects we’ve worked on here, I’ve always been able to make out the cells just fine.

The best advice I can give at this point is to turn up the brightness of your display, or (if you must) output a brighter version of the images by doing some scaling. As you said, you’ll lose the original intensity information, but if you make sure that CP doesn’t overwrite your existing per_image and per_object tables, then the measurements will be just the same. CPA makes no measurements whatsoever based on the images, it only reads what it sees in those tables.

As for getting image paths, they will be output in the CPA console whenever you load an image. ie: when you grab N cells in classifier, you will see a bunch of image loading statements get printed. The filenames should be right there. If you don’t see them, then just scroll up a bit.

I’m sorry I can’t be of more help, but I hope this gets you moving in the right direction. : ) Keep your eyes peeled over the next month for our new multi-class classifier. It will be released as a stand alone application before we get to rewriting the rest of CPA. Good luck!


Thank you Adam.
I will see what I can do and let you know if I have it figured out.
I appreciate the tools you guys provided and am looking forward to more functionalities!



I thought I had that problem too, once. It turned out, the image was there, but the box that was shown in the classification window was too small (focusing on black area). I rightklicked on the square and selected to show the image, and… there it was.
And actually, you can see the image name. Only grab one cell at a time and look it up in the log (terminal window) the name is displayed there. I always drag it to a second screen, so that I can check.
When you classify by group and put the filenames to be the parameter listed by (properties file), the name will be shown in the classification (for score all images).

If you manually write a trainings set and load it - you can also specify which cells to use for rule determination.

I hope I was able to help…


Skadi is right. If your cell_size field in your properties file is set too small then you might not get a good view of the cell (or object) you’re looking at.

I’ll see what I can do to incorporate an easier way to probe images for where they came from in the next release of classifier.


Thank you, Skadi for the input. When I grap one cell to positive/negative repository, nothing happens in the console.
I started to suspect that I don’t have the right version as you guys have, so I re-downloaded the CPA and everything remains the same.
I now contract stretch my images and here is two screen shots:
Notice in the background, the stretched images look ok, but when seen in the full image, the green channel has nothing.

Blue channel is fine though:

That’s all I have got so far.


I can definitely see a problem. Notice that your b&w image which should only be showing the green stain on the cytoplasm, is also saturated in the nucleus. Clearly, your images are being merged, and then displayed as those they are one channel. Still, this isn’t enough to completely explain how to fix the problem. Can you send me your properties file or paste it here? Make sure to remove your db password field.


Yeah, that looks a good explanation. I thought it was showing the blue channel, since I stretched the contrast, there were cytoplasm intensity together with the nuclei. (That’s what they look like in Cell Profiler.)
Here is my properties file
db_type = mysql
db_host =
db_port =
db_name =
db_user =
db_pwd =
spot_tables = 110408_a_Per_Image
uniqueID = ImageNumber
objectCount = Image_ObjectCount_ObjectCount_Cells
cell_tables = 110408_a_Per_Object
objectID = ObjectNumber
info_table =
info_to_spot =
geneinfo_col =
webinfo_col =
webinfo_url_prepend =
image_transfer_protocol = local
image_smb_ip =
image_url_prepend =
image_size_info = N
red_image_path =
green_image_path = Image_PathNames_OrigGreen
blue_image_path = Image_PathNames_OrigBlue
red_image_col =
green_image_col = Image_FileNames_OrigGreen
blue_image_col = Image_FileNames_OrigBlue
cell_x_loc = Nuclei_Location_CenterX
cell_y_loc = Nuclei_Location_CenterY
classifier_per_object_ignore_substr = ImageNumber,ObjectNumber,Location,Parent
classifier_group_table =
classifier_group_col =
cell_size = 75


Well, your properties file seems OK. But it looks as though you’re looking at one multi-channel image rather than 2 single channel images. Maybe this is the problem, but I can’t be of much help until I know (1) that you’ve looked at the images CPA is trying to load and confirmed that they are of a single channel and not corrupted, and (2) what is happening in your console window.

You said “When I grab one cell to positive/negative repository, nothing happens in the console.” If you’re launching the app with CPAnalyst.command then the console should output lots of different information. Whenever you grab cells you should see something like this in your console:

opening image file via HTTP: imaging_analysis/2007_06_26/Imag … 1f00d0.DIB

If your image files are png or tif you should be able to open them in another program and confirm that they are what you expect.

If you see errors in the console, make sure you send the output to me.


For (1), I am sure it is 2 channels. I checked the file names through database query and looked at the images through matlab.
Here I am attaching the screen shots when I switch channels in classifier
Blue channel only:

Green channel only:

For(2). Yes, I run launch the app with CPAnalyst.command. I see filenames in command window when I grab positive/negative/random cells from an image.
I misunderstood Skadi’s post: I thought he was talking about drag and drop into the positive or negative bin.



Are there any errros printed in the console when you view the full sized image? When you switch on/off different channels?


There is no error messages in either cases.


Could you email me a set of your image channels to look at? I’m having a hard time seeing where the problem lies here.