Skip to main content
Participating Frequently
April 16, 2014
Question

Can I select things in a picture based on area?

  • April 16, 2014
  • 3 replies
  • 1044 views

I have a picture where I only want to select certain objects based on the size of them. I would normally do this by hand, but it's a ganglia and there are several hundred points inside that could be large enough. I have all possible points extracted from my original image and so I'm left with hundreds of purple dots of different sizes on a white background. I've looked through the VB scripting guide, youtube, community boards, etc and it doesn't seem like the measurement log interfaces with anything useful. Or is there a way that I don't know to select a point in the measurement log and have it select what it's measuring in the picture?

Thanks,

Scott

This topic has been closed for replies.

3 replies

Inspiring
April 18, 2014

Is this an acceptable result?

https://mega.co.nz/#!oYtBHLAb!dX2lBYe39XyS6reVTr_H0Mmih6hIZi8v2HBYFlVZGGo

Because you can achieve that just by using the blue channel as a mask and playing around with the contrast in this specific case.

Participating Frequently
April 19, 2014

Sort of. It's much cleaner then the ones that I had (how did you do that?), but there are those little purple dots next to the bigger ones. If you had an efficent way of getting rid of the smaller purple dots I would be very interested.

Inspiring
April 19, 2014

I just did a Calculations and multiplied the blue channel by itself, used it as a mask for the image and used curves to give the mask more contrast.

If you're really set on the using the size of the spots to determine the visibility I'm not sure scripting is the way to go, probably best to use plugin development or pixelbender as they give you better access to manipulating the pixels themselves.

I also suspect the custom filter might be of help, I dont really know much about it myself but there seems to be an explanation here: http://ian-albert.com/old/custom_filters/

Also, running a minimum and then a maximum with a value around 2 or 3 (assuming that's about the radius of the spots you want to remain) on the mask should get rid of most of the smaller spots without affecting the shape of the biggers ones too much.

Message was edited by: EnsilZah

c.pfaffenbichler
Community Expert
Community Expert
April 17, 2014

First off I recommend you stop using VB for Photoshop Scripting.

The majority of Photoshop Scripters on this Forum use JavaScript, so the amount of advice and help you are likely to get for VB may not be great.

Secondly: If a sufficiently clear Selection can be generated one might use a Work Path to evaluate the number of elements.

But how exact that would turn out and how exact you need it to be I can’t say.

Chuck Uebele
Community Expert
Community Expert
April 16, 2014

When you say you have the points extracted from your image, are these the count tool markers from the measurement log or dots that you placed?  If they are dots you placed, are they on one layer or separate layers?  What is your ultimate objective: what do you want to do with the selections?  Can you post a sample image.  As far as I know you can't make the measurement tool select areas.

Participating Frequently
April 17, 2014

Supposedly i uploaded two images here, but I can't see either of them, so here is a google drive link to where they are just in case:

So the first one is the original. Those small very darkly purple dots are the target. The smaller ones aren't neurons and need to be discarded. The second image attached I bleached so that all the smaller stuff is gone so you can see the neurons better.

Since when we talked I thought that I could just select everything then do a selection size reduction. Once all the small stuff has been deselected I just expanded it back. It doesn't conform to the edge though and gets rid of a lot of data depending on the neuron shape.

Thanks,
Scott

Participating Frequently
April 17, 2014