dividing an image into squares and counting the cells in each square

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

dividing an image into squares and counting the cells in each square

rona baron
Hi,

 I'm not familiar with imajeJ , but  I would like to know if it is possible
to count the amount of cells in each box of a grid that I generate on the
image.
The detailed procedure is:
I divide the image into 8*8 squares. Now, I need to count how many cells I
have in each square of the grid (or the stained area of each square).

Do you have any suggestions???

Thanks,
Rona
Reply | Threaded
Open this post in threaded view
|

Re: dividing an image into squares and counting the cells in each square

Maloy Ghosh
Hi
In continuation of Rona's question....

We are working on images of particles and cells with different intensities
and sizes. It will be very useful to divide the image in smaller squares and
extracting data from individual square.
The "analyze particle" function gives data from whole image or one selected
region of the image. Is it possible to use multiple ROIs to divide the image
and get information from individual ROI?
I am a new user of ImageJ, any help would be much appreciated.
Regards
Maloy Ghosh


On Tue, Dec 8, 2009 at 7:34 PM, rona baron <[hidden email]> wrote:

> Hi,
>
>  I'm not familiar with imajeJ , but  I would like to know if it is possible
> to count the amount of cells in each box of a grid that I generate on the
> image.
> The detailed procedure is:
> I divide the image into 8*8 squares. Now, I need to count how many cells I
> have in each square of the grid (or the stained area of each square).
>
> Do you have any suggestions???
>
> Thanks,
> Rona
>
Reply | Threaded
Open this post in threaded view
|

Re: dividing an image into squares and counting the cells in each square

Fabrice Senger
Maloy Ghosh a écrit :

> Hi
> In continuation of Rona's question....
>
> We are working on images of particles and cells with different intensities
> and sizes. It will be very useful to divide the image in smaller squares and
> extracting data from individual square.
> The "analyze particle" function gives data from whole image or one selected
> region of the image. Is it possible to use multiple ROIs to divide the image
> and get information from individual ROI?
> I am a new user of ImageJ, any help would be much appreciated.
> Regards
> Maloy Ghosh
>
>
> On Tue, Dec 8, 2009 at 7:34 PM, rona baron <[hidden email]> wrote:
>
>  
>> Hi,
>>
>>  I'm not familiar with imajeJ , but  I would like to know if it is possible
>> to count the amount of cells in each box of a grid that I generate on the
>> image.
>> The detailed procedure is:
>> I divide the image into 8*8 squares. Now, I need to count how many cells I
>> have in each square of the grid (or the stained area of each square).
>>
>> Do you have any suggestions???
>>
>> Thanks,
>> Rona
>>
>>    
>
>  
Hi I wrote a macro to simplify stacks.
It creates an array of roi's and next creates for each roi a new image
wich can then be processed with for example analyze particles...

Her the code, wich may be adapted :




run("Misc...", "divide=Infinity hide");


title = "Untitled";
  width=1; height=1;
  Dialog.create("Image Sampling");
 
 
  Dialog.addNumber("Width divider", 1);
  Dialog.addNumber("Height divider", 1);
 Dialog.addNumber("First slice", 1);
Dialog.addNumber("Last slice", 1);
Dialog.addNumber("Increment", 1);
Dialog.addNumber("Substacks", 1);
  Dialog.show();
 
  wd = Dialog.getNumber();
  hd = Dialog.getNumber();
  fs = Dialog.getNumber();
  ls = Dialog.getNumber();
  inc = Dialog.getNumber();
 substacks = Dialog.getNumber();

run("Slice Remover", "first="+fs+" last="+ls+" increment="+inc);

getDimensions(width, height, channels, slices, frames);

w=width/wd;
h=height/hd;
s=slices;
p=fs;
d=ls;

for (j=0;j<hd;j++){

for (i=0; i<wd; i++) {
x= i*(width/wd);
y=j*(height/hd);
makeRectangle(x, y, w, h);

roiManager("Add");

};

};

setOption("Show All",true);



name = getTitle;
            dotIndex = indexOf(name, ".");
            title = substring(name, 0, dotIndex);




// Get path to result directory
  result = getDirectory("result");
  if (result=="")
      exit("No result directory available");

// Create a directory in temp
  myDir = result+title+File.separator;
  File.makeDirectory(myDir);
  if (!File.exists(myDir))
      exit("Unable to create directory");
  print("");
  print(myDir);













myID = getImageID();
 n = roiManager("count");
 for (i=0; i<n; i++) {
     selectImage(myID);
     roiManager("select", i);
     run("Duplicate...",  "duplicate range="+p+"-"+d);
saveAs("tiff", myDir+title+"_"+i+1);
  close();


 }