Comp Methods Report Final
Comp Methods Report Final
12
Image Processing and Analysis of a Cell Substrate May 1, 2012 Purpose and Significance: The ultimate goal of Dr. Hitchcocks team is to produce large pieces of engineered tissue for use in cardiac reconstruction and modeling. The team has developed a perfusion bioreactor that utilizes a polyurethane scaffold in order to meet this goal. To ensure sufficient mass transport throughout the entire scaffold, the perfusion bioreactor continuously transports oxygen, nutrients, and waste products across the construct. As tissue constructs become larger, however, it becomes more and more difficult to ensure that the distribution of cells within the construct is uniform.
The purpose of this Matlab program is to quantify and analyze the cell distribution along the scaffold in order to allow Dr. Hitchcocks team to assign a specification for cell distribution and work towards meeting it. The computational basis of this project was focused on determining the pixel density of the processed image with respect to the position along the scaffold, where bright pixel clusters correspond to stained cell nuclei. Along with this overall pixel density, a moving average, overall mean, and standard deviation were computed. These metrics allow the research team to quantitatively assess the density of the scaffold and design procedures that meet the desired specifications. Computational Basis: Image composition After cells have been cultured, the lab fixes and images the scaffold using a confocal microscope. Because the microscope images a small section of the scaffold at a time, mosaic imaging techniques are required to view the whole construct in a single image. To achieve this, a user-defined function was created in order to stitch the
Image Processing and Analysis of a Cell Substrate May 1, 2012 individual images together. The ImageStitch function prompts the user to specify the number of rows and columns desired for the final composition. The code then iterates
through a for-loop and prompts the user for an image selection at each instance. Based on the dimensions provided, the code inserts each small image section into a preallocated composite image, and continues along left-to-right, top-to-bottom until all images have been inserted into the composite. The ImageStitch function utilizes the fact that images produced by the microscope are always a set size, 1024x1024 pixels. The blank composite is created by multiplying the input number of rows and columns by 1024. The for-loop then moves along the composite 1024 pixels at a time, moving down a row once the end of the image is reached.
Figure 1 The images above illustrates the progress of the Image Stitching function, with images being added left to right, top to bottom
Image processing In order to process the constructed image, a user-made noise filter and threshold filter are utilized to enhance the image quality and create a binary image that allows for accurate and easy analysis.
The noise filter removes ambient noise generated during the imaging process, in effect, despeckling the image. NoiseFilter is a user-defined function that looks at a pixel and a square radius around it and compares the intensity values against a threshold value. The filter operates under the premise that if a pixel is not just noise, it will have other bright pixels around it, indicating positive staining. If the pixels in the square radius are all below the threshold, the assessed pixel in the center is set to a value of zero (black). If any single pixel is above the threshold, the pixel is allowed to keep its current value. Lastly, the built-in Matlab command imfill was used to fill in the middle of cell clusters that may have been removed by the noise filter. Alternatively, the threshold filter takes a different threshold value, and minimizes or maximizes the value of each pixel based on whether or not it is above or below the threshold value. If the pixel value is below the threshold, it is set to 0. If it is above 0 , it is multiplied by 10,000, ensuring that the maximum value of 255 (8-bit white) is reached. This creates a binary black-and-white image, which allows accurate analysis to be done. Both filters use the built-in graythresh command to obtain the threshold value. Graythresh uses Otsus method to automatically reduce a grayscale image to binary. The algorithm looks at the image and separates it into two classes, one being a brighter foreground, the other being a darker background. An optimal threshold separating the two classes is then calculated. The output threshold value is finally multiplied by 255 to convert it to an 8-bit value. NoiseFilter takes this graythresh-output threshold and multiplies it by a constant specified by the lab, while Threshold simply used the straight value.
Original
Noise-Filtered
Thresholded
Figure 2 The figure below illustrates a comparison of the original image with a Noise-Filtered and Thresholded image
Image analysis The image analysis of this project consists of calculating the pixel density, moving average, and standard deviation of the current image. First, the pixel density was calculated by obtaining the sum of pixel values in each column of the image data matrix, then dividing by 255. Because each pixel can have a maximum value of 255, dividing the sum gives in effect the number of white pixels. This number is then divided by the total height of the image, finally giving the density as the percentage of white pixels for the whole image. By computing the percentage instead of a number, images of different sizes can be compared. This data was then plotted along the x-axis to display the number of cells present over the length of the scaffold. Next, a user-defined moving average function smoothes out the raw pixel data. The MovingAverage function takes one value of the pixel density vector, then looks
Image Processing and Analysis of a Cell Substrate May 1, 2012 behind 5% and ahead 5%, and calculates the average value of all the data along this segment. It then moves to the next pixel and computes the average of that segment, going along the entire scaffold in this manner. This calculation allows for a more
accurate representation and visualization of the average cell density along the length of the scaffold due to the locally irregular data. The program also computes the standard deviation and range of the moving average and displays the results, illustrated in the figure below.
Subsequently, to visualize cell distribution along the substrate, a surface plot was generated. The surface plot was chosen in particular to more easily view the relative pixel density along the scaffold. A surface plot of the raw data produces a relatively
Image Processing and Analysis of a Cell Substrate May 1, 2012 useless display. The raw data is extremely varied and dense, meaning the surface plot generates many peaks of a small width, which make any reasonable visualization
impossible. To circumvent this problem, the program created normalizes the data before displaying it. It first takes the log of all the data, which scales the data relative to itself. Next, the data is divided into square bins, the number of which depending on the overall size of the image. The average value of each bin is then calculated and plotted. By using these bin values instead of the raw data, a smoother surface plot that displays the density and trends of the scaffold is generated.
Figure 4
User Interface: A graphical user interface was created in order to consolidate all the functions in a user-friendly manner. The GUI allows the user to load an image or create a
composite. The user can then apply and display any desired filters to the image. Data is displayed in a separate axis, with the user being able to check boxes to select which specific data to show. Images and data can be zoomed, panned, and axis limits set in order to get a better look. Finally, figures can be saved for later use. Results: The program developed works well, performing all the tasks requested by the lab, as well as performing comparably to programs such as ImageJ, which is a publicly available image processing software that the research team also uses with a more comprehensive approach to image processing and specified data analysis. While the filters utilized in this program are significantly slower than the commercial programs, the user-defined functions allow the end user to adjust the functions to better suit their project. Likewise, the image stitching function is substantially more efficient than the manual PowerPoint method previously utilized by Dr. Hitchcocks lab. Using the analysis of pixel density along the scaffold, this program has already produced figures used in publications to support hypotheses concerning the efficiency of the various seeding procedures utilized by Dr. Hitchcocks lab at perfusing cells along the length of the scaffold, as illustrated below.
Conclusions: Several built-in Matlab capabilities were explored in developing this program, with particular emphasis on built-in image processing commands and image manipulation. Significant obstacles that were encountered in this process included normalization of the data and creation of the surface plot in order to optimize visualization of the cell distribution on the scaffold. Also, because the code was fully developed before creating the GUI, it was unexpectedly difficult to implement the code into a functional and user-friendly GUI, due to unfamiliarity with handles and image display within a GUI environment. This process prompted the development of numerous programming skills, particularly the knowledge of the process and the logic behind developing a program for a particular procedure, as well as incorporating the particular procedures into a GUI. Lastly, the program will continue to be amended with features that allow the user to save and compare data. This will allow users to create figures such as the one above and test other hypotheses. Due to the nature of the code, the program can also be
10
easily modified to work with other image sizes and types, ensuring that it will continue to be an aid to the research team.