PISA

From ZhangLabWiki
Jump to navigation Jump to search

How to use Matlab to identify features in microscope images?[edit]

  • This is a short tutorial on using PISA for feature identification under Matlab.
  • Here we start with a FISSEQ rolony image generated by Hosuk. The goal is to find how many rolonies there are in this image using an algorithm. Here we use the PISA tool that was previous developed for polony haplotyping.
  • To run this tutorial, you need to download two files (PISA7.m PISA7.fig) and place them in your Matlab default or path.
   % Load the raw image
   img_raw=imread('Series021_20xobj-Zstack-2kx2k_MaxProject_Cy5.tif','tiff');
   % Perform median filtering to remove some speckles
   img_flt=medfilt2(img_raw,[3 3]);
   % Find out the dimension of the image
   [xsize ysize]=size(img_raw);
   % Find out the near saturated intensity of the image for adjusting the contrast
   hi=prctile(double(reshape(img_flt,1,xsize*ysize)),99.9);
   % Prepare the image for segmentation
   img_double=double(img_flt)/hi;
   % Create a mask for analyzing a specific region of interest (There are 
        all ones in this matrix, so the wholge image is processed.)
   mask=ones(xsize,ysize);
   % Identification of polonies using PISA. When adjusting parameters, 
        click "Process ROI" first to find out how the new parameters work. 
        Once you find the best parameters, click "Process All".
   % bw_img is a black/white image of all polonies identified;
   % imgsegdata contains all morphological information of all polonies found.
   [bw_img imgsegdata]=PISA7(img_double,mask);
   File:PISA gui.png     


   % Check how many polonies were identified (bw_count).
   [bw_count dummy]=size(imgsegdata);
   % Create a composite image so that you can visually check how many polonies 
         were correctly or incorrectly identified.
   comp_img=zeros(2048,2048,3);
   comp_img(:,:,1)=img_double;
   comp_img(:,:,3)=bw_img;
   imwrite(comp_img,'test_composite_img.png','png');
   % Using an image editor, you can manually identify missing polonies by painting them in white circles.
   File:PISA feature inspection editing.png
  • Further analyses can be perform on imgsegdata or the edited composite image.