retina
Class OIDroiAnalyzer

java.lang.Object
  |
  +--retina.OIDroiAnalyzer
All Implemented Interfaces:
OIDBaseAnalyzer
Direct Known Subclasses:
OIDamplitudeAnalyzer, OIDroiTCAnalyzer

public class OIDroiAnalyzer
extends java.lang.Object
implements OIDBaseAnalyzer

Does ROI analysis of OID files. Uses the shape of the stimulus to find the timecourse of the signal, if any. Copyright (c) 1999-2003, Michael Abramoff. All rights reserved.


Field Summary
protected static float[][] controlMasks
           
static java.lang.String functionName
           
protected static ScriptProcessor scriptProcessor
           
protected static float[][] stimulusMasks
           
 
Constructor Summary
OIDroiAnalyzer()
           
OIDroiAnalyzer(ScriptProcessor scriptProcessor)
           
 
Method Summary
 void analyze(float[][] a, float[][] regEstimates, int frameWidth, java.lang.String directory, java.lang.String name)
          Analyze a series of OID frames a.
protected static double[] division(float[] a, float[] amask, float[] b, float[] bmask)
           
 void exit(int total, int frameWidth, int frameHeight, java.lang.String directory, java.lang.String name)
           
 void init(ScriptProcessor scriptProcessor)
           
 void init(java.lang.String directory)
           
protected static float[] invertMask(float[] mask)
           
protected static void makeBarMasks(java.lang.String directory, int xCenter, int yCenter, float barwidth, float barheight, float xcToT, float ycToT, float xVertical, float yHorizontal, boolean show)
           
protected static float[] makeDiagonalControlMask(int width, int height, int xCenter, int yCenter, int xDistance, int yDistance, float size, java.lang.String direction)
           
protected static float[] makeDiagonalMask(int width, int height, int xCenter, int yCenter, int xDistance, int yDistance, float size, java.lang.String direction)
           
protected static void makeDiagonalMasks(java.lang.String directory, int xCenter, int yCenter, float barwidth, float barheight, float xcToT, float ycToT, boolean show)
           
protected static float[] makeHorizontalControlMask(float[] stimulusmask, int width, int height, float xCenter, float yCenter, float xVertical, float yHorizontal, float barwidth)
          Make a so-called horizontal stimulus mask (a vertical bar).
protected static float[] makeHorizontalHalfMask(int width, int height, float xCenter, float yCenter, float xVertical, float yHorizontal, float barwidth, int side)
          Make a so-called horizontal half mask, i.e.
protected static float[] makeHorizontalMask(int width, int height, float xCenter, float yCenter, float xVertical, float yHorizontal, float barwidth)
          Make a so-called horizontal stimulus mask (a vertical bar).
 void makeMasks(java.lang.String directory, boolean show)
           
protected static float[] makeTControlMask(float[] stimulusmask, int width, int height, float xCenter, float yCenter, float barwidth, float barheight, float xcToT, float ycToT, float xVertical, float yHorizontal)
          Make a T-shaped control mask with all mask pixels 1.
protected static float[] makeTMask(int width, int height, float xCenter, float yCenter, float barwidth, float barheight, float xcToT, float ycToT, float xVertical, float yHorizontal)
          Make a T-shaped mask with all mask pixels 1.
protected static void makeTMasks(java.lang.String directory, int xCenter, int yCenter, float barwidth, float barheight, float xcToT, float ycToT, float xVertical, float yHorizontal, boolean show)
           
protected static float[] makeVerticalControlMask(float[] stimulusmask, int width, int height, float xCenter, float yCenter, float xVertical, float yHorizontal, float barwidth)
          Make a so-called vertical control mask (a horizontal bar).
protected static float[] makeVerticalHalfMask(int width, int height, float xCenter, float yCenter, float xVertical, float yHorizontal, float barwidth, int side)
          Make a so-called vertical half mask, i.e.
protected static float[] makeVerticalMask(int width, int height, float xCenter, float yCenter, float xVertical, float yHorizontal, float barwidth)
          Make a so-called vertical stimulus mask (a horizontal bar).
 boolean prefersRegistration()
           
 void printInfo()
           
protected static void showAndSaveResults(double[][] avgd, double[][] semd, int nrUniqueConditions, java.lang.String directory, java.lang.String name)
          Plot the averages in the column vectors of avg, and also plot CI for avg.
protected static void stats(double[][] signal, double[][] sem, float[][] a, int j, int k, int l, int length, int ix, int nrConditionsPerUniqueCondition)
          Compute signal and SEM for all ROIs for the frame of condition j, frame k.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scriptProcessor

protected static ScriptProcessor scriptProcessor

functionName

public static java.lang.String functionName

stimulusMasks

protected static float[][] stimulusMasks

controlMasks

protected static float[][] controlMasks
Constructor Detail

OIDroiAnalyzer

public OIDroiAnalyzer()

OIDroiAnalyzer

public OIDroiAnalyzer(ScriptProcessor scriptProcessor)
Method Detail

printInfo

public void printInfo()

prefersRegistration

public boolean prefersRegistration()
Specified by:
prefersRegistration in interface OIDBaseAnalyzer

init

public void init(ScriptProcessor scriptProcessor)
Specified by:
init in interface OIDBaseAnalyzer

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

analyze

public void analyze(float[][] a,
                    float[][] regEstimates,
                    int frameWidth,
                    java.lang.String directory,
                    java.lang.String name)
Analyze a series of OID frames a.
Specified by:
analyze in interface OIDBaseAnalyzer
Parameters:
a - a float[][] with the reflectance frames.
regEstimates - a float [][] with the estimates of alignment for each frame with a[0].
frameWidth - the width in pixels of the frames in a
directory - the name of the directory where the result should go.
name - the name(s) of the file(s) on which a is based

stats

protected static void stats(double[][] signal,
                            double[][] sem,
                            float[][] a,
                            int j,
                            int k,
                            int l,
                            int length,
                            int ix,
                            int nrConditionsPerUniqueCondition)
Compute signal and SEM for all ROIs for the frame of condition j, frame k. Divide the average of a ROI by the average over the same ROI of the average baseline frame. So the obtained signal is relative to the average background reflectance Aggregate into signal and sem (Standard Error of the Mean) arrays.
Parameters:
signal - a double [][][] for the signals
sem - a double [][][] for the SEMs
a - the float[][] with the OID frames
j - the current unique condition
k - the current frame
l - the current condition of this unique condition.
k - the current frame within the non-unqiue condition.
length - the length of each frame
nrConditionsPerUniqueCondition -  
division - indicates whether to division (true) or subtraction (false).

division

protected static double[] division(float[] a,
                                   float[] amask,
                                   float[] b,
                                   float[] bmask)

init

public void init(java.lang.String directory)

exit

public void exit(int total,
                 int frameWidth,
                 int frameHeight,
                 java.lang.String directory,
                 java.lang.String name)
Specified by:
exit in interface OIDBaseAnalyzer

showAndSaveResults

protected static void showAndSaveResults(double[][] avgd,
                                         double[][] semd,
                                         int nrUniqueConditions,
                                         java.lang.String directory,
                                         java.lang.String name)
Plot the averages in the column vectors of avg, and also plot CI for avg. Show the plot and save as JPEG files.
Parameters:
avg - a float[][] matrix with a bunch of column vectors with averages to be plotted.
stddev - a float[][] matrix with a bunch of column vectors with stddevs of avg.
name - a String with the name of the vectors being plotted.

makeMasks

public void makeMasks(java.lang.String directory,
                      boolean show)

makeDiagonalMasks

protected static void makeDiagonalMasks(java.lang.String directory,
                                        int xCenter,
                                        int yCenter,
                                        float barwidth,
                                        float barheight,
                                        float xcToT,
                                        float ycToT,
                                        boolean show)

makeDiagonalMask

protected static float[] makeDiagonalMask(int width,
                                          int height,
                                          int xCenter,
                                          int yCenter,
                                          int xDistance,
                                          int yDistance,
                                          float size,
                                          java.lang.String direction)

makeDiagonalControlMask

protected static float[] makeDiagonalControlMask(int width,
                                                 int height,
                                                 int xCenter,
                                                 int yCenter,
                                                 int xDistance,
                                                 int yDistance,
                                                 float size,
                                                 java.lang.String direction)

makeBarMasks

protected static void makeBarMasks(java.lang.String directory,
                                   int xCenter,
                                   int yCenter,
                                   float barwidth,
                                   float barheight,
                                   float xcToT,
                                   float ycToT,
                                   float xVertical,
                                   float yHorizontal,
                                   boolean show)

makeTMasks

protected static void makeTMasks(java.lang.String directory,
                                 int xCenter,
                                 int yCenter,
                                 float barwidth,
                                 float barheight,
                                 float xcToT,
                                 float ycToT,
                                 float xVertical,
                                 float yHorizontal,
                                 boolean show)

invertMask

protected static float[] invertMask(float[] mask)

makeTControlMask

protected static float[] makeTControlMask(float[] stimulusmask,
                                          int width,
                                          int height,
                                          float xCenter,
                                          float yCenter,
                                          float barwidth,
                                          float barheight,
                                          float xcToT,
                                          float ycToT,
                                          float xVertical,
                                          float yHorizontal)
Make a T-shaped control mask with all mask pixels 1. Set all pixels in stimulus mask (the stimulus mask) to 0 so pixels are not in both masks.
Parameters:
mask - a float[] with the stimulus mask.
width - of mask
height - of mask
xCenter - x position of center
yCenter - y position of center

makeTMask

protected static float[] makeTMask(int width,
                                   int height,
                                   float xCenter,
                                   float yCenter,
                                   float barwidth,
                                   float barheight,
                                   float xcToT,
                                   float ycToT,
                                   float xVertical,
                                   float yHorizontal)
Make a T-shaped mask with all mask pixels 1.
Parameters:
width - of mask
height - of mask
xCenter - x position of center
yCenter - y position of center

makeHorizontalMask

protected static float[] makeHorizontalMask(int width,
                                            int height,
                                            float xCenter,
                                            float yCenter,
                                            float xVertical,
                                            float yHorizontal,
                                            float barwidth)
Make a so-called horizontal stimulus mask (a vertical bar).
Parameters:
width - of mask
height - of mask
barwidth - width and height of the bars in pixels.
xCenter - x position of center
yCenter - y position of center
xVertical - x offset of inner edge of bar with respect to center.
yHorizontal - y offset of inner edge of bar with respect to center.

makeHorizontalHalfMask

protected static float[] makeHorizontalHalfMask(int width,
                                                int height,
                                                float xCenter,
                                                float yCenter,
                                                float xVertical,
                                                float yHorizontal,
                                                float barwidth,
                                                int side)
Make a so-called horizontal half mask, i.e. either above or below xCenter depending on side.
Parameters:
width - of mask
height - of mask
xCenter - x position of center
yCenter - y position of center

makeVerticalHalfMask

protected static float[] makeVerticalHalfMask(int width,
                                              int height,
                                              float xCenter,
                                              float yCenter,
                                              float xVertical,
                                              float yHorizontal,
                                              float barwidth,
                                              int side)
Make a so-called vertical half mask, i.e. either left or right of yCenter depending on side.
Parameters:
width - of mask
height - of mask
xCenter - x position of center
yCenter - y position of center

makeHorizontalControlMask

protected static float[] makeHorizontalControlMask(float[] stimulusmask,
                                                   int width,
                                                   int height,
                                                   float xCenter,
                                                   float yCenter,
                                                   float xVertical,
                                                   float yHorizontal,
                                                   float barwidth)
Make a so-called horizontal stimulus mask (a vertical bar).
Parameters:
width - of mask
height - of mask
barwidth - width and height of the bars in pixels.
xExcentric - x position of inner edge of stimulus with respect to center.
yExcentric - y position of inner edge of stimulus with respect to center.
xCenter - x position of center
yCenter - y position of center

makeVerticalMask

protected static float[] makeVerticalMask(int width,
                                          int height,
                                          float xCenter,
                                          float yCenter,
                                          float xVertical,
                                          float yHorizontal,
                                          float barwidth)
Make a so-called vertical stimulus mask (a horizontal bar).
Parameters:
width - of mask
height - of mask
barwidth - width and height of the bars in pixels.
xExcentric - x position of inner edge of stimulus with respect to center.
yExcentric - y position of inner edge of stimulus with respect to center.
xCenter - x position of center
yCenter - y position of center

makeVerticalControlMask

protected static float[] makeVerticalControlMask(float[] stimulusmask,
                                                 int width,
                                                 int height,
                                                 float xCenter,
                                                 float yCenter,
                                                 float xVertical,
                                                 float yHorizontal,
                                                 float barwidth)
Make a so-called vertical control mask (a horizontal bar).
Parameters:
width - of mask
height - of mask
barwidth - width and height of the bars in pixels.
xExcentric - x position of inner edge of stimulus with respect to center.
yExcentric - y position of inner edge of stimulus with respect to center.
xCenter - x position of center
yCenter - y position of center