Hello and welcome Yasika.
Sorry, can’t help here. But I propose an alternative solution. First of all, the manual selection of this 4000 micron line is not ideal as it is inherently biased because your results depend on where you start drawing it… How can you avoid this? As always there are many solutions to a problem, I present a simple one:
Draw a line along the entire purkinje cell layer like so:
Go to edit >> selection >> straighten. Your output will be something like this:
So, now you have all your cells in a rectangular image. You could crop it to 4000 microns width by hand or: write a macro that selects a random 4000 micron width region in this image.
Then the next step is counting cells… which brings up the question of how many of these do you count as cells? The best practice here would be an automated segmentation that defines cells by the same set of rules for every image.
It all depends on how much time you want to invest in this. If you have a lot of images, this would of course save you a ton of time in the end.
Sorry that I couldn’t answer your initial question, but I hope this helps.
Edit: And if you were wondering why this looks different from your image: I used CLAHE to enhance contrast and rolling ball background subtraction to remove some noise.