Difference between revisions of "Software2"

From Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
This subset of programs was primarily written by Dr. Lifshitz.  It is really better to examine the full list of BIG software [[Software | here]].
 +
 
== Visualization ==
 
== Visualization ==
  
Line 7: Line 9:
  
 
== Simulation ==
 
== Simulation ==
===  analyze_simulation.pl -h ===
+
===  analyze_simulation.pl  ===
 +
<nowiki>
  
 
This program takes one or more outputs of a simulation (e.g. output of run1 or run2)
 
This program takes one or more outputs of a simulation (e.g. output of run1 or run2)
Line 34: Line 37:
 
analyze_simulation.pl -verbose run1_cafl.i2i run1_ca.i2i > & sim.out
 
analyze_simulation.pl -verbose run1_cafl.i2i run1_ca.i2i > & sim.out
 
   
 
   
===  calc_diffusion3.pl -h ===
+
</nowiki>
 +
===  calc_diffusion3.pl  ===
 +
<nowiki>
 
     This program reads in a 2D diffusion tracks and calculates a D for each file (track_\d+.out)
 
     This program reads in a 2D diffusion tracks and calculates a D for each file (track_\d+.out)
 
     by fitting a line to the MeanSquaredDisplacement vs time:
 
     by fitting a line to the MeanSquaredDisplacement vs time:
Line 75: Line 80:
  
 
   
 
   
===  compare_volume_measurements.pl -h ===
+
</nowiki>
 +
===  compare_volume_measurements.pl  ===
 +
<nowiki>
  
 
This program combines data produced by cross_sections_of_voronoi (-vfile) with
 
This program combines data produced by cross_sections_of_voronoi (-vfile) with
Line 126: Line 133:
  
 
   
 
   
===  filter_beads.pl -h ===
+
</nowiki>
 +
===  filter_beads.pl  ===
 +
<nowiki>
  
 
Reads in a file produced by makebeads2 (bead.info) and one produced by print_pixel_coords (mask.info).
 
Reads in a file produced by makebeads2 (bead.info) and one produced by print_pixel_coords (mask.info).
Line 172: Line 181:
  
 
   
 
   
===  graph_xpp2.pl -h ===
+
</nowiki>
 +
===  graph_xpp2.pl  ===
 +
<nowiki>
  
 
Reads specified columns of data from an xpp output file.
 
Reads specified columns of data from an xpp output file.
Line 200: Line 211:
  
 
   
 
   
===  oxygen_krogh.pl -h ===
+
</nowiki>
 +
===  oxygen_krogh.pl  ===
 +
<nowiki>
 
     NOT DONE YET.
 
     NOT DONE YET.
  
Line 215: Line 228:
  
 
   
 
   
===  random_path.pl -h ===
+
</nowiki>
 +
===  random_path.pl  ===
 +
<nowiki>
  
 
Generate a random path (ie, diffusion).
 
Generate a random path (ie, diffusion).
Line 243: Line 258:
  
 
   
 
   
===  readbeads.pl -h ===
+
</nowiki>
 +
===  readbeads.pl  ===
 +
<nowiki>
  
 
Reads in file produced by makebeads to check to see if sizes and amplitudes
 
Reads in file produced by makebeads to check to see if sizes and amplitudes
Line 275: Line 292:
  
 
   
 
   
===  run_random_path.pl -h ===
+
</nowiki>
 +
===  run_random_path.pl  ===
 +
<nowiki>
  
 
Generate lots of random paths files (ie, diffusion) by calling random_path.pl multiple times..
 
Generate lots of random paths files (ie, diffusion) by calling random_path.pl multiple times..
Line 300: Line 319:
  
 
   
 
   
===  run_voronoi2.pl -h ===
+
</nowiki>
 +
===  run_voronoi2.pl  ===
 +
<nowiki>
  
 
  This script calls cross_sections_of_voronoi many times, and produces an image and output text file from each run.
 
  This script calls cross_sections_of_voronoi many times, and produces an image and output text file from each run.
Line 312: Line 333:
  
 
   
 
   
===  voronoi_vs_fiji.pl -h ===
+
</nowiki>
 +
===  voronoi_vs_fiji.pl  ===
 +
<nowiki>
 
compare the true volumes of voronoi regions (as reported by cross_sections_of_voronoi, e.g.  
 
compare the true volumes of voronoi regions (as reported by cross_sections_of_voronoi, e.g.  
 
voronoi_D170_0001_g0_G250_volume.txt) to those calculated
 
voronoi_D170_0001_g0_G250_volume.txt) to those calculated
Line 363: Line 386:
  
 
   
 
   
 +
</nowiki>
 
===  ball  ===
 
===  ball  ===
incorrect command line.
+
<nowiki>
 +
 
 
This program creates an elliptical shell of brightness the specified brightness (-i option)
 
This program creates an elliptical shell of brightness the specified brightness (-i option)
 
It is used to create test images for Fischer/hmc.
 
It is used to create test images for Fischer/hmc.
Line 382: Line 407:
 
         code in /home/lml/krypton/facil/ball.c  
 
         code in /home/lml/krypton/facil/ball.c  
 
   
 
   
 +
</nowiki>
 
===  calc_ca3  ===
 
===  calc_ca3  ===
 +
<nowiki>
 
#/home/lml/krypton/bin/calc_ca3  
 
#/home/lml/krypton/bin/calc_ca3  
incorrect command line.
+
 
 
Reads in 4 floating point images (or 4 short int images) as produced by simulation, calculates
 
Reads in 4 floating point images (or 4 short int images) as produced by simulation, calculates
 
the difference image deltaca.i2i (as a floating pt image) between the observed free calcium and what would be
 
the difference image deltaca.i2i (as a floating pt image) between the observed free calcium and what would be
Line 424: Line 451:
 
source code in ~lml/krypton/Walsh directory.
 
source code in ~lml/krypton/Walsh directory.
 
   
 
   
===  cellsim -h ===
+
</nowiki>
 +
===  cellsim  ===
 +
<nowiki>
 
  [0]: in main, before MPI_Init()
 
  [0]: in main, before MPI_Init()
 
[0]: in main, after MPI_Init()
 
[0]: in main, after MPI_Init()
Line 625: Line 654:
 
       ~lml/vision/JSinger/src/channel              (steady state based upon Neher paper)
 
       ~lml/vision/JSinger/src/channel              (steady state based upon Neher paper)
  
===  cellsimL  -h ===
+
</nowiki>
  [0]: in main, before MPI_Init()
+
===  channel_current2 ===
[0]: in main, after MPI_Init()
+
  <nowiki>
[0]: /home/lml/krypton/bin/cellsimL -h
+
channel_current2: like channel_current, but looks at [ca] over time at each BK (not just max [ca]).
help:
+
From that, it calculates the max BK current. Channel_current adds the max [ca] that each BK voxel sees
unable to parse command: -h
+
from each voxel in a Ryr cluster, to get the max [ca] that BK pixel sees.  But the max [ca] could occur
    This program simulates Ca and Na in a cylindrical cell with
+
at different times since the Ryr cluster has a spatial extent.  Experimental.
    cylindrical symmetry.  
+
 
    Note: It is recommended that the stderr output be examined for
+
Calculates the current which would be produced when each object in Ryr_image.i2i releases calcium which
          lines with the words: warning, Warning, error, or Error on them.
+
activates nearby BK channels in BK_image.i2i. Produces a histogram of these output currents.
Usage
+
The input images should have each pixel in an object having the object id as its value. These images can be
    cellsim [options] >& output_datafile
+
produced with "countobjs -Q" or "objs_via_ascent" 
 +
note:  a one pixel border around the image is ignored (added 12/8/09).
 +
This may take about one-half hour to run.
  
Options controlling the duration of the simulation:
+
Usage:
    -time #:       total time to simulate (in sec), default = 0.000000
+
channel_current [options] -f filename Ryr_image.i2i BK_image.i2i > im1_im2.hist
    -time_rate #:  slow down time, ie take smaller dt steps during simulation.
+
Options:
                    this may be necessary if you are creating a large ca gradient,
+
-f filename resting: file containing [ca], in nM, as a function of distance and time. Right now this is
                    for example, with -ca_ring or -ca_src options (.5 means 1/2 the dt).
+
assumed to have 20 nm spacing and entries every msec. See
                    The number of iterations needed for convergence is
+
/home/lml/krypton/Zhuge/STIC/simulations/run32.ca as an example
                    roughly: I= (T*diff)/(dr*dr), where T is time, dr is
+
"resting" is the resting [ca], in nM, for the cell. It will we subtracted from the other
                    annulus thickness and diff is diffusion constant.
+
[ca] values to produce a "delta" [ca] which gets scaled linearly by Ryr intensity.
                    This ignores ion influx,etc.  If you set diffusion rates very
+
The spark current used to produce this (see -C) should be roughly in the range expected
                    small, the iter # calculated will be too small if other stuff
+
for Ryr_image.i2i, since all delta [ca] is linearly extrapolated.
                    is happening, use -time_rate to compensate.
+
All distances > largest distance in filename will have their [ca] set to the [ca]
+
at the largest distance in filename.
Options controlling the geometry of the model:
+
note: Only the [ca] values at y == 1 are used. Is this what should be used?
    -radius #:     radius of the cell in microns, default = 6.000000
+
-u #: voltage (mV).  BK conductance is a function of voltage. default = -80.000000
    -rings #:     radius of the cell in rings, default = 60
+
-U low delta hi: voltages from low to hi by delta. Max is 20 voltages
                    Ring thickness = cell radius/ # of rings.
+
-r #:         resolution (binsize) for output histogram in femtoAmps, default = 1000.000000
    -length #:     length of the cell in disks, default = 300
+
-R #: reveral potential of BK channel in mV, default = -80.000000
                    Each disk will be the same thickness as a ring.
+
 
    -bc Rmax Lmin Lmax:     boundary conditions at maximum radius and minimum and
+
  distances:
                    maximum length coordinate (i.e., at the cell ends). These must
+
-w # # #: x,y, zweights for pixel distances (ie, pixel size), default = 1 for each.
                    be the letters I (for infinite) or S (for solid, i.e. no ions go
+
-p #: pixel size in nm (i.e., what 1 means in -w option), default = 80.000000
                    through the membrane). The I option is not always accurate. default: S
+
-m # :         maxdistance (in units used for -w, i.e., pixels) to look for the closest pixel, default = 10.000000
    -mask image.i2i: only voxels in image.i2i > 0 are part of the cell.  Use this
 
                    to specify an arbitrary shape for the cell.
 
                    Not extensively tested.
 
    -spacing file: file specifies the spacing along each axis (i.e, size of each voxel).
 
                    spacing is in nm, one entry per voxel, comment lines ignored (#).
 
                    The cell direction (X,Y, or Z) must be the first letter on the line.
 
                    Other characters on the line will be ignored.
 
                    The number of entries must be < 2000 each direction.
 
                    Do not specify -rings,-radius,and -length if you use this option.
 
                    NOTE: the simulation time step goes as (length)^2, where length is
 
                          the length of the shortest side of all the voxels specified.
 
                    Any number of entries per line. First R, then D (length). Example:
 
                    # R direction (10 pixels in this direction, high res at low R)
 
                    X
 
                    25 50 75 100 200 300 400 500 600 1000
 
                    Y (lengthwise) direction (9 pixels in D, very high res in the middle)
 
                    100 200 300 400 500 540 550 560 1000
 
                    Use cyl2cart with -spacing option to convert output images to
 
                    a uniform spacing. (I haven't added that option yet)
 
                    Not extensively tested.
 
  
Options specifying substances (ions, buffers, compounds) present in the model (10 max):
+
  which pixels or clusters to include:
    -ion name free_concentration D valence:  
+
-t # #: image1 and image2 thresholds, pixels > # are above threshold, default = 0.
                    concentration in mMolar, D in cm^2/sec, valence in absolute value.
+
-e lowx lowy lowz hix hiy hiz:  only look at voxels within this extent (subvolume), 1-indexed, inclusive.
                    valence is only used if -ion_src is also specified.
+
-s minsize maxsize:     only look at objects in Ryr_image.i2i within the size range (inclusive, in voxels)
                    concentration is the initial free concentration.
+
max size allowed = 100000
    -buffer name total_concentration D:  
+
-S minsize maxsize:     only look at objects in BK_image.i2i within the size range (inclusive, in voxels)
                    concentration in mMolar, D in cm^2/sec.
+
-i miniod maxiod:     only look at objects in Ryr_image.i2i within the iod range (inclusive. use -d also.)
                    concentration is the initial total concentration (sum of its free and all bound forms).
+
-I miniod maxiod:     only look at objects in BK_image.i2i within the iod range (inclusive. use -D also.)
    -kin bufname ionname boundname onrate offrate D:  
 
                    kinetics for interaction between bufname and ionname. Boundname is the
 
                    name to give the bound pair.  bufname and ionname must have been
 
                    specified (with -ion -buffer or -kin options) prior to this option.
 
                    onrate:in 1/(mMolar*seconds), offrate: in 1/seconds, D: in cm^2/sec 
 
    -equil_error relerr iter: maximum relative equilibrium error allowed during the
 
                    initial calculation of concentrations from the user specified
 
                    free ion concentrations and total buffer concentrations.
 
                    rel_error = ABS((true_kd - calculated_kd)/true_kd). Default = 1e-05
 
                    This should be small enough unless you have huge buffer
 
                    concentrations (>100 mM?). iter (an int) is maximum number of iterations
 
                    to allow during equilibration, max =1 billion, default = 10000000
 
  
Options controlling changing conditions:
+
  scale factors:
    -ion_src name current dur lowdisk highdisk lowring highring:  
+
-d Ryrimage1d.i2i #: the original intensity image for Ryr_image (since Ryr_image has pixel values as id numbers)
                    have a current source of the specified ion coming in through the specified rings
+
# is the number of Ryrimage1d.i2i intensity units required to produce spark current
                    and numdisk (rings and disks are 0-indexed indices, inclusive).
+
used in the calcium simulation (which produced the -f filename data).
                    Current is in pA for the specified duration (sec).
+
This will scale the [ca] produced by each Ryr voxel. Default = 30000.000000
                    The current is uniformly divided within the entire specified input volume.
+
-D BKimage2d.i2i #: the original intensity image for BK_image (since BK_image has pixel values as id numbers)
                    All -buffer and -ion options must be specified prior to this.
+
# is the BKimage2d.i2i intensity from one BK channel.
                    See comments by the -time_rate option.
+
This will scale current produced. Default = 1000.000000
    -ion_src_file name imagename current duration:
+
If you want the intensity of each Ryr or BK object to affect the ca release (for Ryr)
                    Similar to -ion_src, but the specified floating point image is used to
+
or number of channels (for BK) , you need to provide the original data by using the
                    scale the input current at each voxel. The total current coming into the
+
-d and -D options. Otherwise all voxels in an object contribute equally (so large objects
                    cell is adjusted so that after this per pixel rescaling, it will = "current".
+
have more receptors or channels than small ones).
                    -ion_current_trace with op = S, will modify this.
+
-c #: BK single channel conductance in pS, default = 220.0
                    Typically do: int2float -M 1 psf.i2i imagename        prior to this.
+
-C #: peak current (in pAmps) used in the simulation to produce -f filename, default = 1.000000
    -ion_current_trace name filename dt op threshold:  modifies current specified with
+
This is just used for output produced by -v to estimate spark current produced per Ryr cluster.
                    the -ion_src or -ion_src_file options.
+
 
                    Times which the channel is open (i.e., current flows) is specified in a file.
+
  miscellaneous:
                    The file is a list of numbers (current or scale), 1 per line, at dt (in sec) intervals.
+
  -v: verbose. produces list of each Ryr cluster and K current produced to stderr. Other stuff too.
                    If op = T, currents greater than the specified threshold means channel open, otherwise closed.
+
To write this to a separate file do: (channel_current -v ... > stdout.channel) >& stderr.channel
                    If op = S, the current as specified with -ion_src is scaled by the number in the list.
+
  -V: very verbose
                    "threshold" is required but ignored when op = S.  Not extensively tested.  
 
    -zap_sub name time:
 
                    At the specified time (in seconds) set the named substance concentration
 
                    to 0. This does not prevent it from being produced from other reactions.
 
                    This is useful if an injected "ion" was photons (e.g., photon+caged -> uncaged)
 
                    and the laser is turned off at the specified time.
 
  
Options related to output:
+
Examples:
    -save name filename type scale dt:
 
                    Save images of the specified substance (name) to specified file. By default
 
                    substances are saved in mM.  This will be multiplied by the scale
 
                    specified here. dt (in sec) is how often to save images.  Type is I
 
                    (short int, our normal format) or F (floating pt,2x space, more accurate).
 
                    The first image saved will be prior to any ion current. The last image
 
                    will always be the end of the simulation. "name" should be as
 
                    specified with the -ion, -buffer or -kin option.
 
                    If the image file already exists, new images will postpended to it.
 
    -save all tag type scale dt:
 
                    Equivalent to -save for all ions and buffers. Uses default file names,
 
                    but adds the tag on the end. ions in nM, all else in uM, then times scale.
 
    -save_flow name rfilename lfilename scale dt:
 
                    Save flow images of the specified substance (name) to specified files.
 
                    rfile is radial flow, lfile is lengthwise flow. Images saved in floating pt.
 
                    Flow is in pA (1 pA = 3 molecules/usec) times scale.
 
                    dt (in sec) is how often to save images. 
 
    -save_flow all ltag rtag scale dt:
 
                    Equivalent to -save_flow for all ions and buffers. Uses default file names,
 
                    but adds the tag on the end. Output same scale as above.
 
                    NOTE: flow for EACH substance takes 8*(number of voxels) of space.
 
    -debug #:      set debug level to #. May substantially slow down the simulation.
 
                    1: extra print statements at init. 2: more testing while running. 3:
 
    -debug_subvolume #: Normally the total mmoles (in the entire cell) of each saved substance is
 
                    printed to stderr.  Setting this option will also cause the printing of the
 
                    total over a subvolume. Subvolume is all y >= # (0-indexed).
 
                    Example: if a cell has patch region at y=[1,10], setting # to the neck (11) of the
 
                    patch will let you see how much actually gets out into the main part of the cell.
 
  
Options related to MPI (multiprocessor stuff):
+
cellsim -spacing /home/lml/krypton/Zhuge/STIC/simulations/spacing2.txt ....     : produces ca.i2i
    invoke on the wolves as, for example,  mpirun -np 3 -machinefile file_of_machine_names cellsim ...
+
printvalsL -spacing2.txt -R -t -i ca.i2i > ca.vals    
    -print_proc #:   only print output from the specified process (0 indexed).
+
kate ca.vals     : delete fist comment line
                  Some output (eg, Total mmoles of ions, etc) are only valid for process 0.
+
      objs_via_ascent -s 5 100 Ryr.i2i Ryrid.i2i > tmp
    -overlap #:   overlap neighboring regions by the specified number of voxels (default = 50)
+
tail tmp  : the mean IOD gives an idea of brightness needed to produce current used in cellsim, say 30000
                  This will also be the number of iterations between necessary synchronization.
+
      objs_via_ascent -s 5 100 BK.i2i BKid.i2i > tmp
    -debug_mpi #print MPI info. Execute MPI dummy stubs if MPI NOT present (eg, under Windows,SGI).
+
tail tmp  : the mean IOD gives an idea of brightness of a BK cluster, eg mean= 10000, but assume that's 10 channels
                  This version of the executable does NOT use MPI.
+
 
    -debug_mpi_proc rank numproc: set dummy rank and number of processes. use only if MPI NOT present!
+
channel_current -f ca.vals -w 1 1 3 -d Ryr.i2i 30000 -D BK.i2i 1000 Ryrid.i2i Bkid.i2i > ryr_bk.info
 +
cull -s -c -1 -4 < ryr_bk.info |xmgrace -source stdin
 +
See also:
 +
closest_object closest_voxel objs_via_ascent /home/lml/krypton/Zhuge/BKandRyr/graph.pl,match.pl
 +
graph_channel_current.pl, test_channel_current, /home/lml/krypton/Zhuge/STIC/simulations/run32  
 +
/home/lml/krypton/Zhuge/BKandRyr/analysis6/cluster_distances.pl, plot_mean_sd_curve.pl
 +
/home/lml/krypton/Zhuge/xpp/ASM15.ode
 +
Bugs:
  
EXAMPLES
+
Source code in ~krypton/lml/facil 
./cellsim -time .0010 -time_rate .5 -length 200 -rings 40 -radius 1 \
+
  # Popen is monotonic as it should be.
        -ion Ca 100E-6 2.5E-6 2 -buffer Fluo3 .050 2.5E-7 -buffer Buf .230 1E-14 \
+
must provide -f cafilename
        -kin Fluo3 Ca CaFl 8E4 90 2.5E-7 -kin Buf Ca CaBuf 1E5 100 1E-14        \
 
        -ion_src Ca 1 .00105 99 102 0 3 \
 
        -save all _run1 I 1 .0001 >& cellsim_run1.out
 
  
 +
</nowiki>
 +
===  cluster  ===
 +
<nowiki>
 +
Drops random Ryr receptors into a world.  Then calculates how many clusters and their sizes get produced.
 +
Currently the "world" default size is  (2um)^3.  (see -wsize)
 +
The origin of this world is in it's center (so it goes from -1um to +1 um in each direction by default).
 +
A histogram of cluster sizes is printed to stdout.
  
Simulate for 100msec saving images every msec. 1 pA comes in the the pattern as specified
+
Usage:
by psf_float.i2i for 10 msec. The current is then modulated by values in current.txt which
+
cluster [options]
are one value per line, dt of 1 msec between them. Cell shape in mask.i2i. Voxel sizes in  
+
Options:
spacing.txt
+
distance options:
./cellsim -time .100 -time_rate .5 -spacing spacing.txt -mask mask.i2i \
+
-eucliddist:      calculate a Euclidean distance (same in x,y,z directions). This is the default.
        -ion Ca 100E-6 2.5E-6 2 -buffer Fluo3 .050 2.5E-7 -buffer Buf .230 1E-14  \
+
  (use -cdist option to set the nearby distance for this).
        -kin Fluo3 Ca CaFl 8E4 90 2.5E-7 -kin Buf Ca CaBuf 1E5 100 1E-14       \
+
-absdist:   rather than calculate a real distance, calculate max(ABS(dx),ABS(dy),ABS(dz)) - for speed
        -ion_src_file Ca psf_float.i2i 1 .010 \
+
  (use -cdist to set the nearby distance for this.)
        -ion_current_trace Ca current.txt .001 S 999 \
+
-psfdist x y z:  distance (in um) a pt can be in the x, y, and z directions and be considered nearby.
        -save CaFl cafl.i2i I 1000 .001 -save Ca ca.i2i I 1E6 .001 \
+
  Does not use -cdist.  To approximate a psf you might specify .2 .2 .6
         -save_flow Ca ca_radial_float.i2i ca_long_float.i2i 1 .001 >& cellsim.out
+
      -cdist #:        how close (in um) two receptors must be to cluster, default = 0.500000
 +
other options:
 +
      -2D:   do a 2D simulation (x and y), not a 3D simulation
 +
-cylinder inner outer:  only place Ryr within a cylinder (e.g., plasma membrane) with specified
 +
                        inner and outer radius (in um). The cylinder has its length the entire y dimension.
 +
  Only the parts of the cylinder which fit in the world (-wsize) are used.
 +
-wsize x y z:   the width of the world (in um) in the x, y, and z directions (default = 2.0,2.0,2.0)
 +
-psize x y z:   pixel width (in um) in the x, y, and z directions (default = 0.1,0.1,0.1)
 +
      -numryr #:       number of Ryr receptors to drop, default = 1000
 +
-mindist #:   when placing Ryr receptors, keep this minimum distance (in um) between them.
 +
-randstart #:   start the random number generator with # as the seed. So runs can be reproduced.
 +
-image name.i2i   write out an image of the Ryr receptors.  Can then use blur3d to create a realistic
 +
  microscope image, and countobjs to analyze it and compare to real data.
 +
diagnostics:
 +
      -debug:          turn on debugging
 +
      -verbose:         be a bit more verbose
 +
      -h:  print this help
 +
      -H:  print this help
 +
      -help:  print this help
  
SEE ALSO
+
Examples:
      ~lml/vision/bin/float2int                    (convert a floating point image to standard SHORT INT format)
 
      ~lml/vision/bin/int2float       (convert normal image to floating point)
 
      ~lml/vision/bin/playexact                    (to display a floating point image)
 
      ~lml/invitro/Kargacin/changeheader          (change header of floating point image)
 
      ~lml/vision/bin/cyl2cart                    (convert from cylindrical to cartesian coords)
 
      ~lml/vision/bin/nadiffl7                    (many more options, but only 1 ion and 2 buffers)
 
      ~lml/vision/bin/diffuse2                    (simple Gaussian spot diffusion program)
 
      ~lml/invitro/Kargacin/iplot                  (3D graph of a 2D image, intensity -> height)
 
      ~lml/invitro/Kargacin/blur4D_dFoverF        (blur with psf, calculate dFoverF)
 
      ~lml/invitro/Kargacin/diffusion_limited_binding  (simulate diffusion limited binding)
 
      ~lml/invitro/Kargacin/spot_diffusion        (simulate diffusion from a spot)
 
      ~lml/vision/facil/printvals                  (print image values, calculate dFoverF)
 
      ~lml/vision/JSinger/src/channel              (steady state based upon Neher paper)
 
  
===  channel_current2 ===
+
Source code in ~krypton/lml/Zhuge/Ryr_clusters  
channel_current2: like channel_current, but looks at [ca] over time at each BK (not just max [ca]).
+
  /home/lml/krypton/bin/cluster -h
From that, it calculates the max BK current. Channel_current adds the max [ca] that each BK voxel sees
 
from each voxel in a Ryr cluster, to get the max [ca] that BK pixel sees. But the max [ca] could occur
 
at different times since the Ryr cluster has a spatial extent.  Experimental.
 
  
Calculates the current which would be produced when each object in Ryr_image.i2i releases calcium which
+
</nowiki>
activates nearby BK channels in BK_image.i2i. Produces a histogram of these output currents.
+
===  diffusion_limited_binding ===
The input images should have each pixel in an object having the object id as its value. These images can be
+
  <nowiki>
produced with "countobjs -Q" or "objs_via_ascent"  
+
unknown option h
note: a one pixel border around the image is ignored (added 12/8/09).
 
This may take about one-half hour to run.
 
  
Usage:
+
Prints out distance (um) and concentration (particles/cm^3) at that distance
channel_current [options] -f filename Ryr_image.i2i BK_image.i2i > im1_im2.hist
+
a slab volume of initial uniform concentration (1 particle/cm^3)which has a ligand
Options:
+
binding to a plane at x = 0This is diffusion limited binding. See my notes of 10/20/98.
-f filename resting: file containing [ca], in nM, as a function of distance and time. Right now this is
 
assumed to have 20 nm spacing and entries every msec. See
 
/home/lml/krypton/Zhuge/STIC/simulations/run32.ca as an example
 
"resting" is the resting [ca], in nM, for the cell. It will we subtracted from the other
 
[ca] values to produce a "delta" [ca] which gets scaled linearly by Ryr intensity.
 
The spark current used to produce this (see -C) should be roughly in the range expected
 
for Ryr_image.i2i, since all delta [ca] is linearly extrapolated.
 
All distances > largest distance in filename will have their [ca] set to the [ca]
 
at the largest distance in filename.
 
note: Only the [ca] values at y == 1 are used. Is this what should be used?
 
-u #: voltage (mV)BK conductance is a function of voltage. default = -80.000000
 
-U low delta hi: voltages from low to hi by delta. Max is 20 voltages
 
-r #:         resolution (binsize) for output histogram in femtoAmps, default = 1000.000000
 
-R #: reveral potential of BK channel in mV, default = -80.000000
 
  
  distances:
+
Usage: diffusion_limited_binding [options] 
-w # # #: x,y, zweights for pixel distances (ie, pixel size), default = 1 for each.
+
options:
-p #: pixel size in nm (i.e., what 1 means in -w option), default = 80.000000
+
  -D #:   diffusion (cm^2/msec), default = 2.2E-09
-m # :         maxdistance (in units used for -w, i.e., pixels) to look for the closest pixel, default = 10.000000
+
  -t t1 t2:   start and stop time to simulate (msec), default = 0.000000 1000.000000
 
+
set both numbers equal if you only want one time point.
  which pixels or clusters to include:
+
  -x x1 x2: start and stop distances to print (um), default = 0.000000 10.000000
-t # #: image1 and image2 thresholds, pixels > # are above threshold, default = 0.
+
set both number equal if you only want one position
-e lowx lowy lowz hix hiy hiz: only look at voxels within this extent (subvolume), 1-indexed, inclusive.
+
  -L #: thickness of slab volume (um), default = 10.000000
-s minsize maxsize:    only look at objects in Ryr_image.i2i within the size range (inclusive, in voxels)
+
  -T #: number of samples in t, default = 10
max size allowed = 100000
+
  -X #: number of samples in x, default = 1000
-S minsize maxsize:     only look at objects in BK_image.i2i within the size range (inclusive, in voxels)
+
  -h: print this help message.
-i miniod maxiod:    only look at objects in Ryr_image.i2i within the iod range (inclusive. use -d also.)
+
  -F: print out time (msec) and flux (particles/cm^2-msec) at x = 0
-I miniod maxiod:     only look at objects in BK_image.i2i within the iod range (inclusive. use -D also.)
+
(i.e., rate molecules binding to x=0 surface).
 +
I've made flux towards lower x positive (normally it would be negative).
 +
  -B: print out time (msec) and total # of particles/cm^2 bound at x = 0
 +
(i.e., brightness of surface). Integral of flux from t1 = 0 regardless of -t option setting.
 +
  -s: don't print out concentration as a function of x (i.e, the entire slab)
 +
 +
</nowiki>
 +
===  ellipse  ===
 +
<nowiki>
  
  scale factors:
+
This program creates an elliptical cell, cell length is in the y direction.
-d Ryrimage1d.i2i #: the original intensity image for Ryr_image (since Ryr_image has pixel values as id numbers)
+
It is used to model a squashed cell, and see how different it looks after
# is the number of Ryrimage1d.i2i intensity units required to produce spark current
+
blurring than a cylindrical cell
used in the calcium simulation (which produced the -f filename data).
 
This will scale the [ca] produced by each Ryr voxel. Default = 30000.000000
 
-D BKimage2d.i2i #: the original intensity image for BK_image (since BK_image has pixel values as id numbers)
 
# is the BKimage2d.i2i intensity from one BK channel.
 
This will scale current produced. Default = 1000.000000
 
If you want the intensity of each Ryr or BK object to affect the ca release (for Ryr)
 
or number of channels (for BK) , you need to provide the original data by using the
 
-d and -D options. Otherwise all voxels in an object contribute equally (so large objects
 
have more receptors or channels than small ones).
 
-c #: BK single channel conductance in pS, default = 220.0
 
-C #: peak current (in pAmps) used in the simulation to produce -f filename, default = 1.000000
 
This is just used for output produced by -v to estimate spark current produced per Ryr cluster.
 
  
  miscellaneous:
+
Usage: ellipse [options] ellipse.i2i
   -v: verbose. produces list of each Ryr cluster and K current produced to stderr. Other stuff too.
+
options:
To write this to a separate file do: (channel_current -v ... > stdout.channel) >& stderr.channel
+
  -d xdim ydim zdim:   dimensions of image, default = (50,100,50)
  -V: very verbose
+
  -r xradius zradius: radius (in pixels) in the x and z directions, default (20.000000,20.000000)
 +
  -s samplerate: number of subsamples in x and z directions per pixel, default = 1
 +
  -i intensity:  intensity inside the ellipse, default = 100.000000
 +
 +
</nowiki>
 +
===  em  ===
 +
<nowiki>
 +
Creates (or reads in) a HMM and then generates random data from it
 +
(each model is a poisson process, with the j_th model having a lambda = 10*j).
 +
Then attempts to use an EM algorithm to estimate the original model.
 +
This is a way for me to learn how to implement the EM algorithm.
  
Examples:
+
Usage: em [options]
 +
options:
 +
  -s #: number of states, default = 2. Must specify -t and -p after this.
 +
  -t # # # ... #: state transition probabilities. If there are S states (e.g., -s #)
 +
                        order: T[1][1], T[1][2], ... T[1][S], T[2][1] ... T[S][S] if there are S states),
 +
                        where T[i][j] is the probability of a transition from state i to state j.
 +
  -p # # # ... #: prior probabilities of states (S entries if there are S states)
 +
  -P #: which prior estimate to use for the pdf of the data (ie., estimate of Poisson process)
 +
        1 = uniform, 2 = delta, 3 = uniform+delta, 4 = peice of observed data histogram (default)
 +
        5 = true pdf (Poisson)
 +
  -n #: number of data points to simulate, default = 100
 +
  -m #: maximum number of iterations to perform, default = 20
 +
        -truetrans: use the true transition probabilities as the initial guess (default = uniform)
 +
        -trueprior: use the true prior probabilities as the initial prior guess (default = uniform)
 +
  -findstates:  also find (and print) the estimate of the states at each time point.
 +
  -v:  verbose. print more info to stderr.
 +
  -V:  print some more info. Some printouts only occur if # data pts is < 1000
  
cellsim -spacing /home/lml/krypton/Zhuge/STIC/simulations/spacing2.txt ....     : produces ca.i2i  
+
Source code in /home/lml/krypton/facil/em.cc
printvalsL -spacing2.txt -R -t -i ca.i2i > ca.vals    
+
See also:  ~/krypton/facil/transpose.pl  to print out selected lines from the output file
kate ca.vals     : delete fist comment line
+
          ~/krypton/matlab/netlab: has EM routines
      objs_via_ascent -s 5 100 Ryr.i2i Ryrid.i2i > tmp
+
          ~/krypton/matlab/bayes/BNT/HMM: has HMM and EM routines
tail tmp  : the mean IOD gives an idea of brightness needed to produce current used in cellsim, say 30000
+
/home/lml/krypton/bin/em -h
      objs_via_ascent -s 5 100 BK.i2i BKid.i2i > tmp
+
 
tail tmp : the mean IOD gives an idea of brightness of a BK cluster, eg mean= 10000, but assume that's 10 channels
+
</nowiki>
 +
===  makebeads2  ===
 +
<nowiki>
 +
/home/lml/krypton/bin/makebeads2
 +
 
 +
randomly distributes beads within a volume.  created to let Jack simulate
 +
distribution of glut4 labels vesicles in the TIRF field of a microscope.
 +
A bead has a constant value between its inner and outer diameters. This value
 +
falls to zero 3 standard deviations inside the inner diameter and 3 sd outside
 +
the outer diameter. Beads are not allowed to intersect each other.
 +
Writes info about beads created or moved to stdout (can be read back in with -b option).
 +
note: coords written out are zero indexed (not 1-indexed like addlines and play) in pixels.
 +
usage:
 +
makebeads2 [options] outimage.i2i
 +
options:
 +
-d x y z: image dimensions in pixels, default = (256,256,64)
 +
-D # #: bead inner and outer diameters in microns, default = 0.200000 and 0.200000
 +
-R #: inner rise standard deviation (in microns), default = 0.012500
 +
-F #: outer fall standard deviation (in microns), default = 0.012500
 +
-S x y z: x, y, and z pixel dimensions (in microns), default = (0.040000,0.040000,0.010000)
 +
-c x y z: x, y, and z pixel dimensions for new image size.  If you are planning on taking the
 +
image produced by makebeads2 and using chres to change pixel size, put the new
 +
pixel sizes here. This is used when calculating the intensity of the brightest pixel
 +
from each bead. This output info can be useful for signal to noise ratio tests.
 +
-X #: number of subpixels per pixels, default = 10
 +
-p # val: set z plane # (0 indexed) to val (modelling diffuse fluorescence on the plasma membrane)
 +
If val is < 1 it is interpreted as a fraction of total light in the image.
 +
For example: val = .2 means set the z plane to the intensity necessary so that the total
 +
light in that plane is 2012f the total in the final image (i.e., after exponential if -e or -E)
 +
-e dist: apply an exponential scale factor exp(-z/dist) to each zslice; like a TIRF excitation intensity
 +
dist is the 1/e distance in microns (.1 is a good value)
 +
This exponential also get applied to z plane value set via "-p # val" if val >= 1. It does
 +
NOT apply to that if val < 1.
 +
-E amp2 dist2:apply a second an exponential scale factor amp2*exp(-z/dist2) to each zslice
 +
must also use -e option.  Each intensity will be scaled by (amp1*exp(-z/dist)+amp2*exp(-z/dist2)).
 +
amp1 + amp2 = 1 and is automatically set when -E is used (amp1 = 1-amp2).
 +
 
 +
options related to output:
 +
-i #: outimage.i2i should be scaled by # before writing it.  Format is short int (our default format).
 +
-f #: outimage.i2i should be scaled by # before writing it.  Format is float.
 +
-v: verbose.
 +
-A: don't create outimage.i2i (still need a dummy name on command line though).
 +
-B: don't even simulate voxels (just prints beads centers, amplitudes, sizes).  Automatically sets -A.
 +
-u file.objs: create file, which has a list of bead objects created, in the same format countobjs produces.
 +
this lets utilities written to analyze files in that format to then be used
 +
(e.g., objs2dist.pl, objs2bb.pl). COM field is the bead center even if part of it is outside
 +
the image. Size field is in pixels (only counting what is within the image).
 +
IOD is the total bead light in the image after exponential weighting (if -e or -E) and scaling (-i, -f).
 +
AVG = IOD/size.  MAX is the max pixel (after -e,-E,-i,-f) . Some file header info may be wrong.
 +
-U file.objs: like -u, but all z coords are replaced by 1, and coordinates are for the new resolution specified
 +
by -c option. MAX value and max coord come from a sum projection in z at the new resolution.
 +
(after -e,-E,-i,-f).
 +
-W: print some warning messages to stderr if appropriate.  note: This will mess up the output in the file
 +
if you are running it as:  makebeads2 -W .... >& file.out
 +
 
 +
options controlling randomization (of a uniform random distribution unless otherwise noted):
 +
  -s min max: mininum and maximum range of allowed bead sizes. This number scales the  
 +
bead inner and outer diameters (does not change sd). default = 1.000000 and 1.000000
 +
-G mean sd:  make bead sizes (scales) a Gaussian variable with specified mean and sd (instead of -s).
 +
note: since beads can't intersect, if you place beads densely you will tend to get more
 +
small beads (since the program generates a new random bead if one doesn't fit), and hence
 +
the size distribution will no longer match the parameters specified here.
 +
-g mean sd shell: like -G, but also specify bead shell thickness in microns.  mean doesn't scale the shell thickness.
 +
mean is the diameter to midway between the inner and outer diameters (so don't use -D option).
 +
-a min max: min and max amplitude (brightness) of bead, default = 1000.000000 and 1000.000000
 +
a pixel which is entirely covered by the shell of the bead (between -D numbers) will have this value.
 +
So this is like specifying a fluorescent concentration.
 +
-P lambda scale:  make amplitude a Poisson variable with the specified mean (lambda) value (instead of -a option).
 +
this value then gets multiplied by scale.  Amplitudes of 0 get ignored (a new amplitude is calculated).
 +
note: this is still just the amplitude of a covered pixel, not of the entire bead unless -T used too.
 +
-T: The amplitude specified with -a or -P option is the total light in the bead, not the light
 +
of one fully covered pixel.  Takes about double the time to run.
 +
note: if the amplitude isn't large compared to number of pixels in the bead's shell, then
 +
individual pixel intensities will be small and truncation may effect total intensity.
 +
-x min max:  allowed position of beads, in pixels, zero indexed, inclusive. The entire bead must fit in this region
 +
unless -o option also specified.
 +
-y min max:  allowed position of beads, in pixels, zero indexed (default = anywhere within image)
 +
-z min max:  allowed position of beads, in pixels, zero indexed (default = anywhere within image)
 +
-o: allow bead centers to fall outside the image volume (except in low z direction, i.e. coverslip).
 +
This is a more accurate way to represent a small view of a large cell.
 +
This option is ignored if -b option used.
 +
-O: like -o, but beads in low z direction outside the volume reflect back inside the volume (i.e. get
 +
moved back inside volume instead of thrown away).
 +
note: if bead density is too high, reflecting a bead inside may cause it to intersect with a previous
 +
bead, in which case the reflecting bead will be thrown away and a new randomly placed bead created.
 +
-w #: use # as the seed for random number generator, so can reproduce exact runs. must be negative.
 +
-b file xyspeed zspeed:  read initial bead params (e.g., size, position) from file, just add random position to this.
 +
the random position uses the speeds (in microns) as the max the vesicle can move in each direction
 +
in this time period (i.e., dx = ran(0 to 1)*xyspeed, etc).
 +
Set xyspeed and zspeed = 0 if you don't want to move the beads.
 +
  -j #: long int starting seed for random number generator. specify the same number (not 0) each time you run this
 +
program if you want to exactly repeat the random numbers generated. The default is to use a different
 +
starting seed each time based upon the process id when you run the program.
 +
-n #: number of beads to make, default = 100, max = 10000
  
channel_current -f ca.vals -w 1 1 3 -d Ryr.i2i 30000 -D BK.i2i 1000 Ryrid.i2i Bkid.i2i > ryr_bk.info
+
Examples:
cull -s -c -1 -4 < ryr_bk.info |xmgrace -source stdin
+
#create 200 beads, with a 50 nm (5 z plane) gap before the pm, which has an
See also:
+
#intensity of 50. Apply a TIRF exponential excitation scale to it.
closest_object closest_voxel objs_via_ascent /home/lml/krypton/Zhuge/BKandRyr/graph.pl,match.pl
+
makebeads2 -e .1 -z 5 63 -p 5 50 -n 200 beads1.i2i > beads1.info
graph_channel_current.pl, test_channel_current, /home/lml/krypton/Zhuge/STIC/simulations/run32 
+
# apply microscope psf
/home/lml/krypton/Zhuge/BKandRyr/analysis6/cluster_distances.pl, plot_mean_sd_curve.pl
+
blur3d -P -N 256 256 128 beads1.i2i empiricalpsf_seg_40nm_seg.i2i beads1_blur3d.i2i
/home/lml/krypton/Zhuge/xpp/ASM15.ode
+
# bin (averge) to 100/160 nm resolution
Bugs:
+
reduceima -A -X 1 256 4 -Y 1 256 4 beads1_blur3d.i2i beads1_blur3d4x4.i2i
 +
# extract infocus plane
 +
segment -Z 16 16 1 beads1_blur3d4x4.i2i beads1_blur2d4x4.i2i
 +
# add ScratchNG camera noise
 +
noise -e 1.4 -n 8 beads1_blur2d4x4.i2i beads1_blur2d4x4N.i2i
 +
histima -size 10 -bins 100 beads1_blur2d4x4N.i2i > beads1_blur2d4x4N.hist
  
Source code in ~krypton/lml/facil 
+
#creates beads, move them, look at the results
# Popen is monotonic as it should be.
+
makebeads2 -z 5 63 beads1.i2i > beads1.info
must provide -f cafilename
+
#read those beads in and move them. but still must stay outside the first 50 nm.
 +
makebeads2 -z 5 63 -b beads1.info .05 .05 beads2.i2i > beads2.info
 +
concateima beads1.i2i beads2.i2i beads.i2i
 +
imsets beads.i2i 2
 +
dave -tdim 2 -4 -I beads.i2i
  
===  cluster  -h  ===
+
#just create scripts (very fast) with positions of beads, and move them around.
Drops random Ryr receptors into a world. Then calculates how many clusters and their sizes get produced.
+
makebeads -z 5 63 -n 200 -A dummy.i2i > beads1.info
Currently the "world" default size is (2um)^3(see -wsize)
+
makebeads -b beads1.info .05 .05 -z 5 63 -A dummy.i2i > beads2.info
The origin of this world is in it's center (so it goes from -1um to +1 um in each direction by default).
+
makebeads -b beads2.info .05 .05 -z 5 63 -A dummy.i2i > beads3.info
A histogram of cluster sizes is printed to stdout.
+
#now create the images
 +
makebeads -b beads1.info 0 0 beads1.i2i > beads1.info2
 +
makebeads -b beads2.info 0 0 beads2.i2i > beads2.info2
 +
makebeads -b beads3.info 0 0  beads3.i2i > beads3.info2
  
Usage:
+
see also: makebead, readbeads.pl, blur3d, project, /storage/big1/sh/simul
cluster [options]
+
 
Options:
+
source code in ~lml/krypton/facil
distance options:
+
   
-eucliddist:      calculate a Euclidean distance (same in x,y,z directions). This is the default.
+
</nowiki>
  (use -cdist option to set the nearby distance for this).
+
===  oxygen  ===
-absdist:   rather than calculate a real distance, calculate max(ABS(dx),ABS(dy),ABS(dz)) - for speed
+
<nowiki>
  (use -cdist to set the nearby distance for this.)
+
Calculates steady state partial oxygen pressure (P) as a function of distance from a blood vessel (r).
-psfdist x y z:  distance (in um) a pt can be in the x, y, and z directions and be considered nearby.
+
The blood vessel has a radius of R1 (5.0 um) and Oxygen at the vessel is Ps (52.0 mm Hg).
  Does not use -cdist. To approximate a psf you might specify .2 .2 .6
+
The default is to print partial Oxygen pressure (mm Hg) as a function of distance (um) as columns to stdout.
      -cdist #:        how close (in um) two receptors must be to cluster, default = 0.500000
+
All models set P at R1 (and r<R1) to Ps. All models clamp P at R1 to be Ps for all time (vessels stay oxygenated).
other options:
 
      -2D:   do a 2D simulation (x and y), not a 3D simulation
 
-cylinder inner outer:  only place Ryr within a cylinder (e.g., plasma membrane) with specified
 
                        inner and outer radius (in um). The cylinder has its length the entire y dimension.
 
  Only the parts of the cylinder which fit in the world (-wsize) are used.
 
-wsize x y z:   the width of the world (in um) in the x, y, and z directions (default = 2.0,2.0,2.0)
 
-psize x y z:   pixel width (in um) in the x, y, and z directions (default = 0.1,0.1,0.1)
 
      -numryr #:        number of Ryr receptors to drop, default = 1000
 
-mindist #:   when placing Ryr receptors, keep this minimum distance (in um) between them.
 
-randstart #:   start the random number generator with # as the seed. So runs can be reproduced.
 
-image name.i2i   write out an image of the Ryr receptors.  Can then use blur3d to create a realistic
 
  microscope image, and countobjs to analyze it and compare to real data.
 
diagnostics:
 
      -debug:          turn on debugging
 
      -verbose:        be a bit more verbose
 
      -h:  print this help
 
      -H:  print this help
 
      -help:  print this help
 
  
Examples:
+
The line source model (-m 1) implements equation 17 from KroghOxygenDiffusionModel1.pdf
 +
  Modeling pO2 Distributions in the Bone Marrow Hematopoietic Compartment.
 +
  I. Krogh's Model  by D.C.Chow, L. A. Wenning, W. M. Miller, and E.T. Papoutsakis
 +
  Biophysical Journal, vol. 81, August 2001, pp. 675-684.
 +
This models O2 assuming a constant oxygen consumption by the tissue and constant O2 (Ps) at the blood vessel.
 +
They claim results don't change by more than a few percent using proportional (or other) O2 consumption models.
 +
The value of dP/dr at R2 is forced to 0.
 +
note: this is an implmentation of O2 from a line source (e.g., blood vessel), not a point source.
 +
So it is not appropriate to convolve (in 3D) this with a 3D image of blood vessels.
 +
But -p (or -m 2) will produce a point source image.
  
Source code in ~krypton/lml/Zhuge/Ryr_clusters 
+
The point source model (-m 2) implements equation 14 from HeatConduction.pdf
/home/lml/krypton/bin/cluster -h
+
  Steady Heat Conduction in Layered Mediums: The Half-Space and Sphere, by Henry N. Pollack
 +
  J. of Geophysical Research, vol. 70(22), Nov. 15, 1965, pp. 5645-5648
 +
This models O2 assuming a constant oxygen consumption by the tissue and constant O2 (Ps) at the blood vessel.
 +
note: The value of dP/dr at R2 is forced to 0 unless -b # is specified.
 +
note: Since O2 consumption is constant, it might not make sense to use this in a convolution, since it isn't
 +
      linear.
  
===  diffusion_limited_binding  -h  ===
+
Model 3 is a point source model, but O2 consumption by the tissue is proportional to the O2 level in the tissue.
unknown option h
+
  I derived it from Crank's equations 6.60 (infinite hollow sphere model) and 14.13 (see below).
incorrect command line.
+
  It requires the specification of an initial O2 level in the tissue (P0, which is the same everywhere).
Prints out distance (um) and concentration (particles/cm^3) at that distance
+
  R2 is used only to determine how far out to plot the graph (and dP/dr at R2 is not used either).
a slab volume of initial uniform concentration (1 particle/cm^3)which has a ligand
+
  See my paper notes or ~/krypton/Corvera/Olga/SteadyStatePointDiffusion.pdf
binding to a plane at x = 0.  This is diffusion limited binding. See my notes of 10/20/98.
+
  Not only is proportional O2 consumption more biological, but I think this should be linear and therefore
 +
  it makes more sense to use in a convolution with a (binarized?) blood vessel image.
  
Usage: diffusion_limited_binding [options]   
+
note: because R2 really should vary in an image, depending upon the distance between nearby blood vessels
 +
        and because Ps is not just a scale factor (so, eg, brighter blood vessels in an image, if brightness is
 +
        proportional to Ps, do NOT just cause a scale factor in the P(r) values), it may NOT be appropriate
 +
to take the image produced by this program and convolve it with an image of blood vessels to get
 +
estimates of oxygenation of tissue. This comment may apply to all three models (definitely to -m 1)
 +
 
 +
Usage: oxygen -m # [options]   
 +
    required:
 +
  -m # which model to use.
 +
        -m 1 :line source model with constant O2 consumption
 +
-m 2: point source model with constant O2 consumption.
 +
        -m 3 :point source model with O2 consumption proportional to O2 concentration.
 +
Use point source models if planning on convolving resulting image with a blood vessel image.
 +
 
 +
    options for all models:
 +
Although these options can be used in all models, different models have different sensitivities to them.
 +
  -R1 # vessel radius (um). Changes to this can change P a lot (if -m 1), and may require R2 to change (see -c).
 +
default = 5.00
 +
  -R2 # max distance any tissue is from a vessel (um). This changes the solution a lot for some models
 +
but for the -m 3 model it only affects how far out data is graphed, default = 2268.00
 +
More precisely, for -m 1 and -m 2 it is the distance at which dP/dr = 0 (ie, a b.c. on the pde).
 +
  -Ps # partial pressure of Oxygen at the blood vessel (mm Hg). Default = 52.00
 +
40 is typical of veins, 95 of arteries. This is held constant over time in all the models right now.
 +
For -m 1, this will affect the O2 value at R1, but how P changes RELATIVE to P(at R1) (as r increases)
 +
will not be affected (ie, it does NOT just scale everything).
 +
    model 1 options:
 +
  -c use with -R1 to automatically calculate R2 based on the specified R1 (since R2 affects the solution).
 +
(this also sets -m 1 as a convenience)
 +
    model 2 options:
 +
  -b # changes the 2nd boundary condition to be P at R2 = # mm Hg
 +
instead of dP/dr = 0 at R2 (this also sets -m 2 as a convenience)
 +
    model 3 options:
 +
  -P0 # the initial oxygenation level of the tissue (mm Hg). Default = 0.000000
 +
This will change the solution a lot, since it is also the level that O2, in steady state, approaches as r->infinity.
 +
Therefore, nonzero P0 may also make convolution with a blood vessel image inappropriate.
 +
-P0 0 seems to produce the same results as -r. (-P0 also sets -m 3 as a convenience)
 +
 
 +
    output graph options:
 +
  -n normalize output (doesn't affect -i image.i2i), ie, print r/R1  vs P/Ps  rather than r vs. P
 +
  -r add a third reference column which is the "simple" diffusion solution (goes as 1/r)
 +
This is for a point source in 3D (not a line source), and ignores O2 consumption.
 +
graph as: oxygen_krogh -r | xmgr -nxy stdin
 +
 
 +
    output image options:
 +
  -i image.i2i xdim ydim zdim:  create an image of the values, to use with blur3d to find
 +
O2 everywhere in an image as a function of distance from blood vessels.
 +
If you are planning on convolving you should probably specify -m 3 .
 +
  -d x y z if -i is specified. pixel dimensions in um. default = 0.60 0.60 10.00
 +
  -s # if -i is specified. scale output intensities by #. Otherwise max is 52.0 mm Hg
 +
  -o xorig yorig zorig: location of the blood vessel in the image (zero indexed, floating point)
 +
blur3d may care about this, depending upon options. default = (0.00,0.00,0.00)
 +
(maybe I should change this to define a line in the image when -m 1 is specified?)
 +
-p the output image should be for the simple 1/r point source (see -r explanation) rather
 +
for the line source (-m 1) or point source with O2 consumption (-m 2 or -m 3).
 +
 
 +
    other options:
 +
  -v verbose. stuff to stderr.
 +
  -V more verbose. stuff to stderr. debugging info.
 +
  -h print this help
 +
 
 +
Examples:
 +
      # create a binary image of blood vessels (maybe use BestPath3D_ellipse instead? Maybe thin3D afterwards?):
 +
    mask_image -m 2700 -r 1 G03_x_1_2_r4.i2i G03_x_1_2_r4.i2i G03_x_1_2_r4_binaryvessels.i2i
 +
      # create a psf of blood oxygenation:
 +
    oxygen -s 500 -i O2ptsource.i2i 50 50 21 -d 2.58 2.58 10 -o 25 25 10 -m 3 -r > O2ptsource.xy
 +
    blur3d -S .002 -Z -d -v G03_x_1_2_r4_binaryvessels.i2i O2ptsource.i2i G03_x_1_2_r4_O2.i2i
 +
 
 +
see also:  /home/lml/krypton/Corvera/Olga/README, SteadyStatePointDiffusion.pdf (my notes)
 +
        Random Walks in Biology (New, expanded edition) by Berg p. 23 eq. 2.11;
 +
The Mathematics of Diffusion (2nd Ed) by Crank p. 32 eq  3.5b; p. 89 eq 6.5; p. 102 eq 6.60; p. 330 eq 14.13
 +
source code in:  /home/lml/krypton/facil
 +
error: A model must be specified, i.e., -m # must be specified.
 +
 
 +
 
 +
</nowiki>
 +
===  sparkspread  ===
 +
<nowiki>
 +
 
 +
Calculates the spread of spark event amplitudes given that two events occur at the same
 +
spark site and compares it to the spread of amplitudes given that two events occur at
 +
different spark sites. A spark site has a unique (x,y) position.
 +
Prints mean and stddev to stdout. Also prints out histograms and cumulative distributions.
 +
 
 +
A valid datafile has either blank lines, comments (start with #) or a data line (spark event).
 +
A data line has 8 or 11 fields. 11 if a stoc is associated with the spark event
 +
A valid stoc (last 3 fields) must have a nonzero stoc amplitude (1st of 3 fields)
 +
See /usr/people/lml/vision/Rhonghua/Sparks/singlesitev2 for a valid file format.
 +
 
 +
Usage: sparkspread [options] datafile
 
options:
 
options:
  -D #:   diffusion (cm^2/msec), default = 2.2E-09
+
  -h: do NOT print histogram for intraspark data.
  -t t1 t2:   start and stop time to simulate (msec), default = 0.000000 1000.000000
+
  -H: do NOT print histogram for interspark data.
set both numbers equal if you only want one time point.
+
  -c: do NOT print cumulative distribution for intraspark data.
  -x x1 x2: start and stop distances to print (um), default = 0.000000 10.000000
+
  -C: do NOT print cumulative distribution for interspark data.
set both number equal if you only want one position
+
  -b #: number of bins for histogram, default = 20
  -L #: thickness of slab volume (um), default = 10.000000
+
  -n: normalize the histograms so their maximum is 1
  -T #: number of samples in t, default = 10
+
  -k: also print ks statistic showing if two distributions are different.
  -X #: number of samples in x, default = 1000
 
  -h: print this help message.
 
  -F: print out time (msec) and flux (particles/cm^2-msec) at x = 0
 
(i.e., rate molecules binding to x=0 surface).
 
I've made flux towards lower x positive (normally it would be negative).
 
  -B: print out time (msec) and total # of particles/cm^2 bound at x = 0
 
(i.e., brightness of surface). Integral of flux from t1 = 0 regardless of -t option setting.
 
  -s: don't print out concentration as a function of x (i.e, the entire slab)
 
 
   
 
   
===  ellipse ===
+
</nowiki>
incorrect command line.
+
===  spot_diffusion ===
This program creates an elliptical cell, cell length is in the y direction.
+
<nowiki>
It is used to model a squashed cell, and see how different it looks after
+
unknown option h
blurring than a cylindrical cell
+
 
 +
Prints out time (secs) and concentration (nMolar) seen at a distance
 +
from a channel with a constant current, open for specified time.
  
Usage: ellipse [options] ellipse.i2i
+
Usage: spot_diffusion [options]
 
options:
 
options:
  -d xdim ydim zdimdimensions of image, default = (50,100,50)
+
  -D #diffusion (cm^2/sec), default = 2.2E-06
  -r xradius zradius: radius (in pixels) in the x and z directions, default (20.000000,20.000000)
+
  -c #:  current (pAmp), default = 1
  -s samplerate: number of subsamples in x and z directions per pixel, default = 1
+
  -s #:  starting concentration (resting level, in nM), default = 0
  -i intensity: intensity inside the ellipse, default = 100.000000
+
  -T #:   total time to simulate (seconds), default = 1.000000
 +
  -t #: length of time current is on (seconds), default = 1.000000
 +
  -r #: distance from channel opening (um), default = 0.100000
 +
  -R r0 r1 dr: average over a range of distances (crude psf), from r0 to r1 by dr (in um)
 +
  -n #: number of time points to sample, default = 1000.000000
 
   
 
   
===  em  -h ===
+
</nowiki>
Creates (or reads in) a HMM and then generates random data from it
+
===  total_ca ===
(each model is a poisson process, with the j_th model having a lambda = 10*j).
+
<nowiki>
Then attempts to use an EM algorithm to estimate the original model.
+
#/home/lml/krypton/bin/total_ca
This is a way for me to learn how to implement the EM algorithm.
 
  
Usage: em [options]
+
Reads in a floating point image or short int image as produced by simulation (i.e., cylindrical coords), calculates
options:
+
the total calcium change (i.e., [ca](r)*pi*r*r - t(0)) as a function of distance from the calcium entry site.
  -s #: number of states, default = 2. Must specify -t and -p after this.
+
Output is printed to stdout.
  -t # # # ... #: state transition probabilities. If there are S states (e.g., -s #)
+
All input concentrations should be in nM
                        order: T[1][1], T[1][2], ... T[1][S], T[2][1] ... T[S][S] if there are S states),
+
Each z slice is analyzed separately (i.e., z is assumed to be time) unless image is rectangular and 3D (-R).
                        where T[i][j] is the probability of a transition from state i to state j.
 
  -p # # # ... #: prior probabilities of states (S entries if there are S states)
 
  -P #: which prior estimate to use for the pdf of the data (ie., estimate of Poisson process)
 
        1 = uniform, 2 = delta, 3 = uniform+delta, 4 = peice of observed data histogram (default)
 
        5 = true pdf (Poisson)
 
  -n #: number of data points to simulate, default = 100
 
  -m #: maximum number of iterations to perform, default = 20
 
        -truetrans: use the true transition probabilities as the initial guess (default = uniform)
 
        -trueprior: use the true prior probabilities as the initial prior guess (default = uniform)
 
  -findstates:  also find (and print) the estimate of the states at each time point.
 
  -v:  verbose. print more info to stderr.
 
  -V:  print some more info. Some printouts only occur if # data pts is < 1000
 
  
Source code in /home/lml/krypton/facil/em.cc
+
Usage: total_ca [options] ca.i2i
See also: ~/krypton/facil/transpose.pl  to print out selected lines from the output file
+
      options for printing graphs of calcium (not concentration) vs. distance from ca entry location:
          ~/krypton/matlab/netlab: has EM routines
+
the units for the graph are nM*um^3, but 1nM = .6ions/um^3 , so multiply be .6 to get ions
          ~/krypton/matlab/bayes/BNT/HMM: has HMM and EM routines
+
                      (and 1pA = 3,000 ions/msec if you want to convert to pA-msec).
/home/lml/krypton/bin/em -h
+
        -n: normalize calcium distance graph for each z slice (so sum of amplitudes = 1),
 +
                      (otherwise when graph spacing is changed, -g option, the height of the graph will change).
 +
  -a:   print absolute calcium, not delta calcium (the default).
 +
                      when this is applied to a uniform image it should produce a 4pi*r*r distribution.
 +
            The default, delta calcium, prints the delta (i.e., change) from slice 0 (regardless -z option)
 +
        (but delta calcium not calculated if 3D rectangular, i.e., -R specified).
  
== Statistics ==
+
  -p # #: pixel size in microns in the radial (x) and lengthwise (y) directions,
==cluster_distances.pl -===
+
default 0.10 and 0.10
 +
  -P # # #: pixel size in microns in x,y,z directions (rectangular not cylindrical coords),
 +
default = ( 0.10, 0.10, 0.10)
 +
  -r: data is rectangular, not cylindrical coords (-P sets this too)
 +
(e.g., already passed through cyl2cart).
 +
  -R: data is 3D rectangular (not 2D+time), not cylindrical coords.
 +
  -e x y:      0-indexed coords of calcium entry location (default: x= 0, y = ydim/2)
 +
  -E x y x:    0-indexed coords of calcium entry location for 3D rectangular data
 +
(i.e., z direction is not time). sets -R option.
 +
        -g #: graph spacing. default is the pixel size.
 +
        -s #:        subsample each voxel this number of times in the x (radial) and y (longitudinal) directions,
 +
                      (and z if 3D and not 2D+time) default = 3 (anything less tends to introduce errors).
 +
        -z low hi dz: only look at z slices low to hi (0-indexed, inclusive), stepping by dz.
  
Takes output from channel_current2 (after 11/24/09) and pulls out statistics about
+
see also:
mean distance to each BK cluster.  Then produces average stats from all the files
+
    printvals, float2int, in matlab: readxmgr, acurves (see ~lml/krypton/JSinger for an example)
analyzed. Output to stdout.
 
  
 +
source code in ~lml/krypton/Walsh directory.
 +
 +
</nowiki>
 +
===  vcspat-models  ===
 +
<nowiki>
 +
argc = 1
  
  usage:
+
This program creates a volume image with objects randomly placed
 +
within it. The mask image defines where an object is allowed to be placed.
 +
The mask value can be changed with the -M option.  Objects can either be individual
 +
voxels (the default) or tiny images (-o option) or connected voxels in an image (-O).
  
   -files:file1:file2:...:filen       which files to analyze. Defaults are files named 2_*.currents in cwd.
+
Usage:
  -numBKvsProb       also prints numBK vs prob data suitable for xmgrace
+
   vcspat-models [options] mask.i2i out.i2i
  
 +
Options:
 +
  -m #    : model number (default 0).
 +
            0 - grid pattern
 +
            1 - random pattern
 +
  -M #    : value of mask pixels (default 1).
 +
  -r #    : number of random points to use in random pattern (default 25000)
 +
  -o name  : image to use at point in pattern (default just turns on a pixel)
 +
(can use up to 256 images - image will be randomly chosen)
 +
  -a : if objects overlap, add their pixel values instead of just replacing
  
example:
+
Options related to objects:
   (channel_current2  .... > file.channel_current) >& file1.currents
+
   -O thresh name.i2i: threshold an image to use for objects. Extracts as an object each
  (channel_current2  .... > file2.channel_current) >& file2.currents
+
            connected set of voxels above threshold.  Places these  objects randomly
   cluster_distances.pl -numBKvsProb -files=file1.currents:file2.currents > avg_distances.txt
+
            into the output image (uses each object once). Use with the
   fgrep -v clusters avg_distances.txt |xmgrace -pipe
+
            -m 1 option. Do not use the -r option
 +
  -P name.i2i id.i2i: similar to -O option, extracts as an object each of the
 +
    the objects in name.i2i based upon their pixel values (object id) in id.i2i
 +
(e.g., id.i2i was produced via objs_via_ascent). This option preserves the
 +
distinction between objects in name.i2i which may be touching - since simple thresholding is not used.
 +
If only an id.i2i is available (no name.i2i), you can specify -P id.i2i id.i2i
 +
   -v: replace objects (after fitting them into the image) with just the single voxel
 +
at the brightest location in the object. Only use with -O and -e options.
 +
  -S # #:   minimum and maximum object sizes to allow (use with -O option).
 +
  -e: do not allow (exclude) objects to be placed so that they overlap with each
 +
other, go outside the image, or go outside the mask.  The default is to allow
 +
overlaps and to just zero out that part of an object which goes outside the
 +
image volume or mask.
 +
   -n: number the objects in out.i2i (use with -O or -P options). Rather than all
 +
the pixels in an object being their original values, all the pixels in object 1
 +
will be labeled 1, all those in object 2 labeled 2, etc.  If -e not specied and
 +
objects overlap the first object placed (usually the largest) will prevail.
 +
Can also be used with -v, then output will have the brightest voxel set to object id, others to 0.
 +
The output of this can be analyzed by object_overlap program.
 +
  -N out2.i2i:  create a second output file, number the objects in out2.i2i (like -n).
  
note: mean distances to clusters are not always increasing (e.g., mean distance to 10th
+
OtherOptions
      cluster could be SMALLER than the mean distance to the 9th cluster).  I think this
+
  -s #    : seed for random number generator (default pid)
      has to do with limiting my maximum distance (see comments in this file).
+
  -x #    : x increment for grid pattern (default 3)
 +
  -y #    : y increment for grid pattern (default 3)
 +
  -z #    : z increment for grid pattern (default 3)
 +
  -V: verbose
  
+
note: entire image name (with extension) is required.
see also:
+
note: a - in place of an image name means stdin or stdout.
   channel_current2
+
Examples:
   /home/lml/krypton/Zhuge/BKandRyr/analysis6/run12
+
   objs_via_ascent in1.i2i inid1.i2i
   /home/lml/krypton/Huang/Kth_pt.m
+
   objs_via_ascent in2.i2i inid2.i2i
   p. 637 of Cressie.  
+
   vcspat-models-new -m 1 -M 1 -P in1.i2i inid1.i2i -N outid1.i2i  mask.i2i out1.i2i
 +
  vcspat-models-new -m 1 -M 1 -P in2.i2i inid2.i2i -N outid2.i2i  mask.i2i out2.i2i
 +
  object_overlap outid1.i2i outid2.i2i  > obj_overlap
 +
   overlapL out1.i2i out2.i2i > coloc
  
   
+
See also: krypton/Qiong/run1, vcspat, randompuncs, spatial_stats2, objs_via_ascent, countobjs
=== coloc.pl  -h  ===
 
  
calls coloc3way with a bunch of different thresholds. Creates an output file which can be
+
Source code in /storage/big1/lml/jac/was_invitro/Projects/cspat-volume
graphed with VennDiagram.m.
 
  
coloc.pl im1.i2i im2.i2i im3.i2i > out.coloc3way
+
</nowiki>
 +
== Image Analysis ==
 +
===  Corecell.pl  ===
 +
<nowiki>
  
options:
+
Takes a 3d image and an outline and keeps all data pts within the specified distance
-time_vs_thresh just generate a file which shows which times correspond to which thresholds. images can be dummy names.
+
of the outline (removes the "core" of the cell). 
 +
Also produces a file named in_image_H.histo. See help for histogram2 about that.
 +
If in_image2.i2i out_image2.i2i are specied, in_image2.i2i is also cored
 +
(and histogram2 is applied to the pair in_image.i2i and in_image2.i2i when producing in_image_H.histo).
  
-t1=#:#:# threshold one should go from # to # by #. default = 800:1200:50
+
Written to let Ronghua only keep BK and Ryanodine label near the plasma membrane.
-t2=#:#:# threshold two should go from # to # by #. default = 800:1200:50
+
Note: touching voxels may have a distance of .5 voxels, and voxels at the same
-t3=#:#:# threshold three should go from # to # by #. default = 2000:4000:200
+
      position may have a distance of -.5 (??)
-numthresh=#1:#2:#3  ignore the third number in the -t1, -t2, and -t3 options (or in the default) and instead calculate a
+
Note: pixels may be kept near the end of the cell, since they have close distance to the end
  threshold step size so that #1 thresholds are applied to im1.i2i (dat image)
+
      (rather than to the plasma membrane. Might -Z # # option to histogram2 fix this?).
  #2 thresholds are applied to im2.i2i (ctx image), #3 thresholds are applied to im3.i2i (rin image).
+
Note: there might be problems if boundary.pts touches the edge of the image.
  e.g., -numthresh=5:10:10 will apply 5 different thresholds to im1.i2i, and 10 thresholds to im2.i2i and im3.i2i.
 
  Using this option lets me insure that each call to coloc.pl will produce exactly the same number of data points;
 
  this may make the statistical comparison between cells easier.
 
  
-Melikian=file in addition to creating output for VennDiagram, create text file with the coloc percentages
 
Dr. Melikian is interested in. Graph via xmgr -nxy. See header in file for coloc info.
 
For this to work the three image files MUST be specified in the order 405  594  488 (i.e., rin.i2i ctx.i2i dat.i2i)
 
-Melikian2=file Same as -Melikian, but dat (488) is image 1, ctx (594) image 2, and rin (405) image 3
 
-area=file.xyr also print out Melikian data as xyr where r is proportional to the number of pixels involved
 
(i.e., the denominator used when calculating the percent colocalized).
 
prints to "file.xyr".  Must also specify either -Melikian or -Melikian2
 
xmgrace -graphtype fixed -settype xyr file.xyr
 
-matlab=file:#  like -area but as columns so easy to read into matlab: t p1 n1 p2 n2 p3 n3 p4 n4
 
# is the max n value (ie, all n values are scaled so the max over n1,n2,n3,n4 is #).
 
Since p1,p2,p3,p4 are percent, # is typically set to a small part of that, e.g. .05.
 
If # is negative then abs(#) is just used as a scale factor (so -1 would just keep the
 
n values as the number of voxels). Graph in matlab with line width of 2*n1:
 
matlab  # import data=(tdim,9)
 
>> lowy = data(:,2) - data(:,3); hiy = data(:,2) + data(:,3);  x = data(:,1);
 
>> area(x,hiy,'FaceColor',[1 0 0],'EdgeColor','r','LineWidth',1); hold on;
 
>> area(x,lowy,'FaceColor',[1 1 1],'EdgeColor','r','LineWidth',1);
 
Must also specify -Melikian or -Melikian2.
 
  
-debug
+
Corecell.pl [options] in_image.i2i boundary.pts out_image.i2i [in_image2.i2i out_image2.i2i]
-verbose
+
 
 +
options:
 +
-interp interpolate missing z slices in boundary.pts before using it.
 +
zslices must be in ascending order in boundary.pts.
 +
contours must all be drawn in the same direction (i.e., all clockwise or all counter-clockwise).
 +
The name of each object is changed to "nuke".  A maximum of 1000 zslices is allowed.
 +
-shrink=#  shrink boundary.pts by this number of pixels before using it
 +
-expand=#  expand boundary.pts by this number of pixels before using it
 +
-zrange=#:#    only examine z slices (1-indexed in this range)
 +
-dist=#: keep all voxels within this distance of the boundary, default = 2
 +
-dx=#          pixel size x size (default = 1. all that really matters is relative x,y, and z size)
 +
-dy=#          pixel size y size (although if you change this then that may affect -dist)
 +
-dz=#          pixel size z size
 +
-dontcapends    first and last outline slices aren't capped (removes -c from the call to histogram2).
 +
        typically you'd use this if the outlines are circular cross-sections of a cylindrical
 +
cell (ie, z is along the length of the cell).  If the outlines are along the length
 +
of the cell (ie, cell is in the xy plane, as Jeff likes to do), then you wouldn't use this option.
 +
-verbose print out extra info to stderr as it goes along
 +
-vverbose very verbose
 +
-keepfiles keep all intermediate files (all begin with _)
  
 
example:
 
example:
 +
  #cell's length is in the xy plane, need to flip it to get cross sections to outline with planimeter3
 +
  transp -YZ im.i2i im_YZ.i2i
 +
planimeter3 -I im_YZ.i2i -R im_YZ.pts
 +
  transp -YZ im2.i2i im2_YZ.i2i
 +
  #cell's original zspacing = 250 nm, but x and y are 80, so relative spacing is about 3:1, after transp
 +
  #it is the y direction that has the 250 nm spacing.
 +
Corecell.pl -dy=3 -dist=3 -interp im_YZ.i2i im_YZ.pts im_YZ_near_pm.i2i im2_YZ.i2i im2_YZ_near_pm.i2i
 +
dave -T 1 YZ -T 2 YZ -z 3 -I im_YZ_near_pm.i2i -I im2_YZ_near_pm.i2i
  
coloc.pl im1.i2i im2.i2i im3.i2i > coloc.data
+
see also: shrink_wrap (to apply prior to Corecell.pl to get a better starting surface)
coloc.pl -time_vs_thresh im1.i2i im2.i2i im3.i2i > coloc.times
+
matlab
+
</nowiki>
>> VennDiagram('coloc.data','percent')  # and manually look at coloc.times while doing this to convert times to thresholds.
+
===  count_2d_objs2.pl ===
 +
<nowiki>
 +
run countobjs on a 2D time series
 +
creates temporary files _temp.i2i and _temp.stats in the current directory.
 +
note: scale and black level forces each time point to be rescaled the same and
 +
      therefore to be thresholded the same.
 +
file.stats will have data ordered as:
 +
time number_of_objects mean_iod sd_iod mean_size sd_size
 +
 
 +
count_2d_objs2.pl [options] image.i2i file.stats
 +
 
 +
options:
 +
  -tstart=# first time point to examine, default = 1
 +
  -tstop=# last time point to examine, default = last z slice.
 +
  -min=# minimum size object to allow, default = 1
 +
  -max=# maximum size object to allow, default = 100000
 +
  -thresh=# threshold, default = 0
 +
  -scale=# scale, default = 1
 +
  -black=# black, default = 0
 +
  -allstats=filename print info about each object to _temp.stats (otherwise just summary stats from each t printed)
 +
and rename it "filename"
 +
  -outimage=image.i2i see -o option in countobjs.  
 +
  -Outimage=image.i2i see -O  option in countobjs
 +
  -Qimage=image.i2i see -Q option in countobjs, note: id numbers will restart from 1 on each slice.
  
see also:
+
  -verbose
~/krypton/packages/fiji/Fiji.app/plugins/jacob_.jar  - more traditional colocalization measures
+
  -dummy
coloc_tseries2
+
  -noclean
colocalizeL
 
  
 
   
 
   
===  probcircle.pl -h ===
+
</nowiki>
  given a sphere of diameter D, what is the prob of oberving a disk of radius r when a random plane intersects it?
+
===  distance2surface_overtime.pl  ===
  prints to stdout: r  prob(r) 1/prob(r)
+
<nowiki>
 +
 
 +
Finds the distance (in pixels) of a specified pt (over time) from the nearest pixel
 +
greater than 0 in 3Dimage.i2i (or greater than -threshold).  Alternatively, finds
 +
the distance to the boundary surface specified with the -surface option.
 +
The coords is as produced by track_pts (x y z otherstuff).
 +
Written to let Andrea take a tracked gene in the nucleus and find its
 +
distance to the nuclear envelope over time.
 +
Note: touching voxels may have a distance of .5 voxels, and voxels at the same
 +
      position may have a distance of -.5 (??)  
  
  usage:
+
distance2surface.pl [options] 3Dimage.i2i specifiedpt.coords outfile.dist
      probcircle.pl [options]  
 
  
  options:
+
options:
-D=# default = 1
+
-surface=boundary.pts find distance to the surface defined by boundary.pts
-just_prob don't print the third column
+
  rather than the distance to nearest >0 voxel 3Dimage.i2i
 +
-shrink=#  shrink boundary.pts by this number of pixels before using it
 +
-expand=# expand boundary.pts by this number of pixels before using it
 +
-zrange=#:#    only examine z slices (1-indexed in this range)
 +
-threshold=#    threshold 3Dimage.i2i (voxels <= threshold set to 0, > threshold set to boundary).
 +
-pixel=# pixel size (in x and y) in nm
 +
-verbose print out extra into to stderr as it goes along
 +
-vverbose very verbose
 +
-keepfiles keep all intermediate files (all begin with _)
  
  examples:
+
      probcircle.pl | xmgrace -free -pipe -nxy -
+
</nowiki>
 +
===  extract_area2.pl  ===
 +
<nowiki>
 +
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at /home/lml/krypton/bin/extract_area2.pl line 85.
  
  see also: p. 249 stereology_book.pdf
+
</nowiki>
    /home/lml/krypton/packages/fiji/stereology_lml.template
+
===  findpaths_exo4.pl ===
    /home/lml/krypton/Corvera/Raz/stereology/plot_results.pl
+
<nowiki>
    /home/lml/krypton/facil/cross_sections_of_sphere
 
  
+
this program takes output from exo4.
===  compare2dist  ===
+
similar to findpaths_exo3.pl, but parses exo4 output rather than exo3 output.
incorrect command line.
+
 
This program calculates whether two amplitude distributions are the same.
+
usage:
It was written to examine Rhonghua's STOCS data to determine whether the increase
+
  findpaths_exo4.pl file1.out
in observed STOC frequency could be explained by an increase in STOC amplitude
+
 
(since then more events above threshold would be observed).
+
options:
datafile2 should be the one with larger amplitudes (so we hypothesize it has fewer missing
+
 
events if it is just a version of datafile1 shifted higher).  It will get shifted down
+
which paths:
by a range of shifts (-s option) and compared with datafile1.
+
  -prestring="# debugpath 3 (102,156,-1):"  pull out paths that begin with this. default is the null string.
This routine also compares the temporal interarrival time distribution of each datafile with
+
    : null string paths should also be saved_paths later.
that predicted by a poisson process and with the other datafile; the temporal calculations
+
    : "# debugpath .*:"  will pull out all the debugpaths (. matches any char and * means
ignore all missing data issues and shifting issues for now.
+
    : number of them)
 +
  -saved_paths     :  all the saved paths (within -zrange if that is also specifed)
 +
  -debugpaths     :  all the debug pathsThese options are mutually exclusive.
 +
  -zrange=minz:maxz     :  only print tracks which start within the z range specified (1-indexed, inclusive)  
 +
 
 +
what to do with the paths:
 +
  -saved_labels=filename    :  implies -saved_paths. saves labels for each path into the specified filename. This  
 +
    :  file can be read into play so that labels are visible at a location.
 +
for rpts file:
 +
  -rptsfile=track.rpts      :  create an rpts file (initially empty). use -rptstracks and -printfusion to put stuff in it.
 +
  -rptstracks     :  put paths (tracks) into the rpts file specified with -rptsfile    
 +
  -printfusion=#     :  print box (of width #) around fusion events to rptsfile. must us -rptsfile option with this.
 +
    :  note: -debugpaths do not have valid fusion times.
 +
  -pathcolor=#     :  instead of -1
 +
  -boxcolor=#     :  color of fusion box. instead of -2
  
This program reads data in the form:
+
for xmgr file:
     time calcium prior_baseline post_baseline amplitude
+
  -trackxmgr=track.xmgr     :  create an xmgr file of the tracks produced by the program "exo".
      where the values are
+
  -truetime     :  rather than use z value as "time" calculate time based on the "burst protocol"
      time:           time of STOC
+
    :  of 60 seconds acquisition at 1Hz followed by 3 seconds at 20HZ, repeatedly.
      calcium:         SR calcium level
+
  -peak     : rather than print avg (iod/size), print the peak pixel value (ie, value of maxima).
      prior_baselineamplitude just prior to STOC
+
  -finalfit     : rather than print avg, print the best fit curve (based on final fit parameters).
      post_baselineamplitude just after STOC
+
  -initfit     rather than print avg, print the init fit curve (based on initial fit parameters - for debugging).
      amplitude:       amplitude amplitude of STOC (not relative to baseline)
+
  -distance     : rather than print avg, print the distance from the first pt on the curve.
Data is expected to already be sorted by time (smallest to largest).
+
   -maxtracks=#     :  for -trackxmgr, only print out this many tracks.
comment lines must begin with a #
+
  -tracks=start:skip     :  for -trackxmgr, only print tracks starting at track "start" (1-indexed) and
 +
    :  skip "skip" paths beforing printing another one (e.g., print every skip paths).
 +
    :  this lets you print a subset of paths which are still spread over the entire z range
 +
    :  to make visualization easier. skip = 0 means don't skip any. 
 +
misc:
 +
  -verbose
 +
  -stationary_time=filename : print time each path is stationary prior to fusion to specified file
  
Usage: compare2dist [options] datafile1 datafile2
+
example:
options:
+
  exo4 -d 120 -o adp12273_ids.i2i -V -w 10 -b 2 adp12273_c1_z1201_1320_masked.i2i > & adp12273_c1_z1201_1320_masked.out
    -t #: only include data with an amplitude > #. The default
+
  play -min 0 adp12273_ids.i2i    # maxima of each region should be blue
is to assume a 0 threshold. If you have acquired the data
+
  findpaths_exo4.pl -trackxmgr=adp12273.xmgr -truetime adp12273_c1_z1201_1320_masked.out
using some thresholding criterium (eg, only peaks above
+
  xmgr adp12273.xmgr    #clicking on each set brings up its legend info which has its
10picoamps are counted) then you should provide that number
+
        #starting coord (1-indexed I think) and value.
here, even if all your data is above this (ie, you've applied
+
  findpaths_exo4.pl -rptsfile=adp12273.rpts -rptstracks -printfusion=4 adp12273_c1_z1201_1320_masked.out
the threshold in your identification phase). This is because
+
  addlines adp12273_c1_z1201_1320_masked.i2i adp12273.rpts - | play -P -1 R -P -3 G -
we need to know it when we shift amplitudes of the second
+
 
distribution to see if it could match the first distribution.
+
see also: ~lml/krypton/Huang/TIRF4/graph_exo3.csh
    -b: subtract average baseline from amplitude prior to use (ie, prior
+
to any thresholding or intensity shifting of data).
+
</nowiki>
    -s delta max: shift datafile2 amplitudes down by a maximum of max, in
+
===  get_find_vesselness_results.pl ===
increments of delta, to see if it will then match datafile1.
+
<nowiki>
  -p #: our guess of the percentage of data missing from datafile2 because it was
+
Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at /home/lml/krypton/bin/get_find_vesselness_results.pl line 115.
below our threshold/detection criteria (a # from 0 to 1).
 
This plus the amount of datafile2 shifted below threshold determines
 
our estimate of the amount of data missing from the shifted datafile2 and
 
the unshifted datafile1. The larger this number is, the more likely
 
the two curves will appear similar (since differences in actual data
 
examined will be proportionally smaller differences, and we are assuming
 
all missing data matches exactly, but see -m below). Default = 0.000000
 
    -m: assume all missing data maximally MISmatches, this would probably be
 
a worst case scenario, so that if the KS statistic says the distributions
 
could be the same even with the -m option, its probably trueBut I'm
 
not certain of this, since it really depends how this affects the
 
relative spacing between the cumulative distributions. I'd have to
 
think about it some more.
 
  
see also:test_distr, poisson
+
</nowiki>
This code is in ~lml/vision/Rhonghua/STOCS
+
===  mask_and_coloc.pl  ===
  #/home/lml/krypton/bin/compare2dist
+
  <nowiki>
 +
Takes a threshold, x and y translation for vinculin image, a pts file, and two images, and creates a mask
 +
and then calculates colocalization. See README.
  
=== compare2gaussian  ===
+
mask_and_coloc.pl -x=# -y=# -thresh=# -pts=file.rpts -vin=vin.i2i -trip=trip.i2i
incorrect command line, need 1 data files.
 
This program calculates whether a given set of data could be samples from a known mixture of Gaussians.
 
datafile should have one data point per line. comment lines begin with #.
 
Output statistics to stdout.
 
  
Usage: compare2gaussian [options] datafile
+
options:
options:
+
  -tx=# translate by a max of -tx when calculating other colocalization numbers, default = 25
      -t #: only include data with an amplitude > #. The default is to include all data.
+
  -ty=#
  -g # amp1 mean1 sd1 ... :
+
  -step=# step size for other translations, default = 5
The Gaussian mixture model the data should be compared against (using a KS statistic).
+
  -noclean don't clean up (ie, don't remove) intermediate files created during this analysis
# is the number of Gaussians, this is followed by the amplitude, mean, and sd of  
+
  -overlap=file   just calculate overlap3, reusing the other files, put result into file.
each Gaussian. The default is one Gaussian with mean = 0 and sd = 1.
+
 
You can get these values using the fitgaussians2 program.
+
  -v: verbose. Also prints the observed (first) and theoretical (second) curves to stdout.
+
</nowiki>
  -T: test. runs through x = 0 to 10 and prints out cumulative prob. exits.
+
===  mask_gedmat_images4.pl  ===
 +
<nowiki>
 +
  mask_gedmat_images4.pl  -check_intersect  added.
 +
determines when outlines intersect and sets the aerr (area error flag) in the
 +
output file. eventually it will calculate areas a different way when that happens
 +
rather than combining masked images (see ~/krypton/Corvera/Raz/README for 10/18/13). not done yet ...
 +
 
 +
  Examines all the zip files (produced within fiji when outlining regions) in the current directory. These have
 +
  the boundary of the explant, day7 growth, and day11 growth.
 +
  note: this program assumes that all the data in the directory is from the same patient and the same tissue type.
 +
 
 +
  It recalculates the area measures by only including that part of the day7 and day11 growth which is between the explant
 +
  center and going towards the center of the well; area from the explant center going away from the center of the
 +
  well (ie, growing towards the well wall) is excluded. By doing this, we hope to minimize the
 +
  effect of growth (as measured by area) being stopped by the well wall when the explant is near the well wall. 
 +
  Output is written to stdout. The comments there explain the fields. area_mex is the old value, area_mex_border is the new.
 +
 
 +
  This is done by finding all the *_Area.zip files in the current directory, pulling out the outlines in those files
 +
  and using that information to recalculate areas. It also needs to find the associated "combined" image file
 +
  (*_combined.i2i) to get image size and hence the position of the center of the well) and the fiji results file
 +
  (*_results.txt, so the numbers produced here can be easily compared with them).  
 +
 
 +
  note: The algorithm assumes that the area NEVER DECREASES with time, and that the explant region is always surrounded
 +
by the day7 region which is surrounded by the day11 region. The latter assumption is sometimes invalid if
 +
the day 11 images were shifted relative to day 7 images; but that is usually ok.
 +
(if necessary, you can manually change the "bad_data" field in the output file to 1 and then use
 +
-cond in gedmat_to_xy.pl to eliminate those stats from further analysis.)
 +
It also assumes the smallest area in each zip file is the original explant area, the next largest area is
 +
called day7 area and the largest area (if 3 are present) is assumed to be day 11 area.
 +
Sometimes when growth is about 0, the outlines on, eg, day7, may have slightly less area than the original
 +
explant, so the outlines might be mis-ordered then. [actually it may read the correct day off the name of
 +
the i2i image now].
 +
 
 +
  note: If only 2 areas (ie, two .roi files) are present in the zip file, they are assumed to be for
 +
the explant and day7 (not day11).
  
See Also: fitgaussians2, fit2gaussians, fit3gaussians
+
  note: This program assumes the center of the combined image (usually 4 well images are combined into one) is the
 +
center of the well. see combine_images.pl. It also assumes the combined image name ends in combined.i2i
 +
(see -combined).
  
Source code is in ~lml/krypton/Lefkowitz
+
  note: some of the scripts I use to then analyze these results will multiply the area by 2, to get a "true" estimate
#/home/lml/krypton/bin/compare2gaussian
+
  of growth; since the value produced by mask_gedmat_images3.pl will be (roughly) half of the real growth rates.
  
===  compare_dist2  ===
+
  usage:
incorrect command line.
+
mask_gedmat_images3.pl  [options]
This program calculates whether two distributions are the same using chi-square test (unless -k).
 
It was written to examine the distribution of sizes of Ryanodine Receptor objects
 
to determine if they are randomly distributed. datafile1 should be the reference
 
data (gotten from many simulations or from a theoretical formula), datafile2
 
should be the real data (max number of data values = 100000).
 
  
This program reads data which is just a list of sizes of objects seen (one per line).
+
  options:
Comment lines must begin with a #
+
-tmpdir=fullpathname directory to use for temporary files which are created, eg: -tmpdir=/home/lml/krypton
Floating pt numbers are truncated to integers for bin number (max bin number = 50000).
 
  
Usage: compare_dist2 [options] datafile1 datafile2
+
-zip_file=file.zip
options:
+
-zip_file=file.zip:file2.zip:...:filen.zip
  -k perform K-S test instead (I'm not certain the numbins I use to calculate this is correct).
+
only examine the one specified zip file, not all those in the directory
  -a also print the histograms produced
+
(If the second form is used, you can specify as many as you want.)
  -b also print the normalized histograms (total count datafile2 scaled to the same count as in datafile1,
+
note: you may still need to specify -zip_ending so that the ending of this file can be stripped
  bins with 0 removed), this is only done if -k not specified (ie, only if performing chi-square test).
+
      off correctly (so the -combined_ending and -results_ending can then be added correctly).
  -c also print the cumulative prob distributions (only done if -k also specified)
+
-zip_ending=stuff e.g., -zipending=_area.zip  .  All files which end in this will be analyzed; default = _Area.zip
  -r # #: only analyze sizes within the specified range (inclusive)
+
-skip=file.zip[:file2.zip...]  list of zip files (without the full path) to skip.
  -m #: cap the maximum number of counts for any size in datafile1 to #
+
 
  -M #: cap the maximum number of counts for any size in datafile2 to #
+
-results_ending=stuff e.g., -results_ending=_results.txt  . This is what the -zip_ending should be replaced by
  -z: for chi-square keep zero entry bins (chi square only correct if this option is NOT used)
+
to get the name of the associated fiji results file.  note the _ should be included here
so why is this option here?  if you just really want to use this program to do
+
if it was included in -zip_ending.
histogram normalization (-b), and don't care about the stat.  xmgrace running avg
+
 
will produce strange results if you don't use -z, ie, if data not equally spaced.
+
-combined_ending=stuff e.g., -combined_ending=_combined_reduced_.i2i . default = combined.i2i.
  -v verbose
+
This is any string which helps identify the last part of the combined image filename.
  -V very verbose
+
-combined_scaling=#:# e.g., -combined_scaling=2:2 if reduceima -bin 2 2 was applied to get _combined_reduced_.i2i.
example:
 
      create a simulated distribution and compare it with real restored data (real_ryrr.i2i, run5 does this 100 times):
 
  cluster -wsize 10 43 25 -cylinder 0.001 3 -psize 0.08 0.08 0.25 -mindist 0.030 -numryr 500 -image ryr.i2i
 
  blur3d -S 40000 -P ryr.i2i psf.i2i ryr_b.i2i
 
  noise -c RCA ryr_b.i2i ryr_bn.i2i
 
  setenv myloc /home/lml/krypton/Zhuge/Ryr_clusters
 
  setenv eprloc /storage/big1/epr/queues
 
  echo "  /storage/big1/epr/run_epr -V -log -NSC 4 -sm 1e-05 -it 5000 -sc 0.025 -co 0.001
 
-psf ${myloc}/psf.i2i ${myloc}/ryr_bn.i2i ${myloc}/ryr_bnr.i2i " > /storage/big1/epr/queues/standard/lml.0
 
  while (1==1) if ( ( ! -e ${eprloc}/standard/lml.0 ) && ( ! -e ${eprloc}/running/lml.0 ) ) then break endif sleep 60s end
 
  countobjs -k -s 5 300 -t 4500 4500 sim_ryr.objs ryr_bnr.i2i
 
  cull -s -c -2 < sim_ryr.objs > sim_ryr.stats
 
  countobjs -k -s 5 300 -t 4500 4500 real_ryr.objs real_ryrr.i2i
 
  cull -s -c -2 < real_ryr.objs > real_ryr.stats
 
  compare_dist2 -b sim_ryr.stats real_ryr.stats  >& chi_ryr
 
  compare_dist2 -k -b sim_ryr.stats real_ryr.stats  >& ks_ryr
 
  tail chi_ryr ks_ryr
 
  xmgrace chi_ryr; xmgrace ks_ryr
 
  
see also: cluster, run5
+
-scale=#:# distance and area (eg, -scale=2:4 if reduceima -bin 2 2 was used) scaling. This will multiply
This code is in /home/lml/krypton/Zhuge/Ryr_clusters/
+
the area stored in the fiji file and the area calculated via my mask by the second number.
  #/home/lml/krypton/bin/compare_dist2
+
The first number will multiply the distance of the explant from the center of the image.
 +
This option is just here to handle 001_BAP and 002_PRO datasets. They were analyzed in fiji
 +
with the images reduced by a factor of 2 in x and y. So the fiji areas produced will be low
 +
by 4x, as will my areas. This option compensates for that.  See ~/Corvera/Raz/README for 10/11/13.
  
=== correlationL  ===
+
-check_intersect check if outlines intersect with the explant's outline. If so, set an error flag on stdout printout
/home/lml/krypton/bin/correlationL
+
and print info to stderr. eventually will just use area numbers rather than masking area in this situation.
incorrect command line.
+
that is not done yet ...
This program plots intensities from image1 vs intensities from
+
 
image2. image1 on the x axis, image 2 on the y axis. Intensities
+
 
in both images are rescaled 0 to the size of the output image
+
-save_day[=directory]
(default = 512).  The intensity at each pixel in the output
+
saves the final binary mask for each days growth (eg, day7 growth minus the explant and minus the part growing towards the wall)
image is the number of (image1,image2) voxels with that particular
+
into a 3d mask image (patientid_tissue_day#_mask.i2i).  This image will be reduced down in xdim and ydim from the
intensity combination.
+
original.  patientid_tissue_day#_.play_labels will also be created (labels which well each z slice comes from).  
The intent is to be able to look at the output image and get a sense
+
This is mostly for quality control purposes.
for whether there is a correlation between intensities
+
In addition, patientid_tissue_day#.rpts will be created (similarly reduced down in size) (coords may be off by 1?).
in the two imagesIf so, perhaps a least squares line
+
View the file via: addlines maskim.i2i maskim.rpts - |play.FC14 -P -1 R -labels maskim.play_labels -
fit should be done to see how well one images correlates with the  
+
  or via: play_results3.pl
other, or -s option can be specified.
+
patientid_tissue_day#_orig.i2i will be the original images (also reduced in xdim and ydim, and only one 2d slice
The minimum, maximum, and scale factors are printed to stdout.
+
from each original 3d image).
Version 1.1
+
note: older versions of play may need the comment line at the top of maskim.play_labels removed.
 +
note: if you want images to be in another directory, specify a full pathname, eg -save_day=/home/lml/krypton (without last /).
 +
note: any existing file with these names will be OVER-WRITTEN.
 +
note: this option creates lots of temporary files (in tmpdir) of the form __*.i2i, any existing
 +
      files that match this will be DELETED.  
 +
see also: montage
  
Usage: correlation [options] im1.i2i im2.i2i out.i2i
+
-just_check just check whether each zip roi outline has the correct number of associated image files.  
options:
+
eg, if the zip file has 3 outlines (explant, firstday, secondday) there should be two i2i files with DAY# in their name.
  -d xdim ydim: output dimensions of new image
+
prints to stderr info about those which don't have the correct number. does nothing else.
(default = 512,512).
+
-verbose some extra info to stdout
  -S im1scale im2scale: scale intensities with these scale factors. newval = (intens-min_intens)*scale
+
-debug prints some tracing info to stderr
  -B b1 b2:     force min_intens (black level) to specified valuenewval1 = (intens-b1)*scale1
+
-print_fname print name of each zip file as it is being analyzed, to stderr.
  -i val1 val2: Ignore any voxels in image1 <= val1 and
+
-dlevel=# extra debugging. the bigger the number the more the printout. # is an integer starting at 1.
any voxels in image2 <= val2.
+
-dlevel=1 will print a trace of commands to execute to mimic (parts of) this perl script.
 +
-noclean don't remove the temporary files which were created
 +
the files are: _ones.i2i _explant.rpts _day11.rpts _day7.rpts _excluded_region.rpts
 +
      _explant.i2i  _day11.i2i _day7.i2i _day7_noex.i2i _day11_noex.i2i _day7_noex_halfex.i2i _day11_noex_halfex.i2i
 +
  (if multiple zip files were analyzed, only the files from the last one will be left, since they get reused)
 +
-dont_recalc only for diagnostics. does NOT restrict the analysis to just the growth away from the wall.
 +
with this specified this entire program should just reproduce the numbers we already
 +
have in *Results.txt since that uses the entire area. ie, this make the program a no-op.
  
  -h val1 val2: Ignore any voxels in image1 >= val1 and
+
  see also:
any voxels in image2 >= val2.
+
/home/lml/krypton/Corvera/Raz/README
 +
analyze_gedmat3.pl a script which calls mask_gedmat_images3.pl for all of Raz's data. Also versions 4,5,6, and 7.
 +
play_results3.pl
 +
raz_rates.pl
 +
mask_gedmat_images.pl
 +
mask_gedmat_images2.pl
 +
/storage/big1/raz/GEDMAT/
 +
ReadROI.pl
 +
extract_area.pl
 +
combine_images.pl
 +
gedmat_to_xy.pl
 +
/home/lml/krypton/Corvera/Raz/analyze_gedmat.pl
 +
chres_rpts.pl
 +
  filter_rptsinz.pl
  
  -r: instead of intensities, use the rank
+
  examples:
order of the intensities.
+
cd /storage/big1/raz/GEDMAT/006_JTH/OM
  -a: automatically calculate the size of the
+
 
output image. attempts to make the scale
+
# generate 006_JTH_OM.areas with all the data (area_mex_border is the number which should replace farea)
factor = 1.
+
# also produce 006_JTH_OM_7masks.i2i and 006_JTH_OM_11masks.i2i so I can check on the validity of the algorithm.
  -b: keep the xdim and ydim scale factors the same.
+
# place diagnostic mask images in /home/lml/krypton/Corvera/Raz/output and the output data file in
  -s: calculate Spearman rank-order correlation
+
# /home/lml/krypton/Corvera/Raz (note: all directories must already exist).
coefficients. print results to stdout.
+
mask_gedmat_images.pl -tmpdir=/home/lml/krypton/Corvera/Raz/output  -zip_ending=_Area.zip -results_ending=_Results.txt
  -z zslice:    only examine the specified z slice (the first
+
-combined_ending=combined.i2i -days=7:11
slice is considered slice 0).
+
-save_day=/home/lml/krypton/Corvera/Raz/output
note: entire image name is NOT required.
+
>& /home/lml/krypton/Corvera/Raz/006_JTH_OM.areas
note: a - in place of an image name means stdin or stdout.
 
  
examples:
+
# look at the masks produced:
    # to apply this to a set of 3D images, using the same scales and size images for easy comparison
+
cd /home/lml/krypton/Corvera/Raz/output
correlationL -S s1 s2 -d 512 512 -B 0 0 image1.i2i corr1.i2i    (and same for other images)
+
      play_results3.pl 006_JTH_OM_day7
+
or:
===  create_imagesL  ===
+
fgrep -v # 006_JTH_OM_11masks.play_labels > tmp.play_labels  # eliminate the comment line, play doesn't like those.
incorrect command line.
+
play -labels tmp.play_labels 006_JTH_OM_7masks.i2i
This program takes output from many runs of "overlap" and
 
produces two images. One image is a percent colocalization image
 
and the other is a probability image. The overlap program MUST be
 
run via the "many_overlaps" command. The probability calculations
 
are the same as those performed by "probcolocal", but only -n
 
needs to be specified since the other values are automatically
 
extracted from the file produced by "many_overlaps".
 
  
The percent image is the percent of voxels above threshold in image1
+
# compare the full areas produced which what fiji did (as a check). only pull out the good data. they should be very similar:
(as originally specified to "many_overlaps") which overlap with
+
cd /home/lml/krypton/Corvera/Raz
voxels above threshold in image2. A 100 in the output image = 100 percent.
+
gedmat_to_xy.pl -cond='if (($date eq "date_sure")&&($perr==0)&&($aerr==0)) {1;} else {0;}'
The probability of observing as much (or more) overlap as we did due to
+
-xcoord='$area' -ycoord='$farea' 006_JTH_OM.areas | xmgrace -free -pipe
random chance is the prob.i2i image.  Probabilities are mulitplied by 100.
 
  
Position along the y-axis (vertical axis) of the image, corresponds to
+
# now grab the data we really want. compare the old way, with the area when the growth half near the well border is masked off:
thresholds for image2. The x-axis represents image1 thresholds.  The
+
gedmat_to_xy.pl -cond='if (($date eq "date_sure")&&($perr==0)&&($aerr==0)) {1;} else {0;}' 
lowest threshold is the bottom left corner.  See the first line in
+
-xcoord='$area_mex' -ycoord='$area_mex_border' 006_JTH_OM.areas | xmgrace -free -pipe
your datafile for the range of thresholds this represents.
 
Overlap produces statistics for a range of allowed overlaps.
 
Create_images, by default, chooses an overlap within 1 voxel.
 
If you want to use a different overlap distance use the -o option.
 
  
See also: overlap, probcolocal, many_overlaps
+
# it may be hard to see some of these images as they are very large, do it this way (note the -L to keep the -1 boundary values):
 +
addlines _ones.i2i _excluded_region.rpts - | reduceima -bin 3 3 -L - -|play -P -1 R -P -2 G -P -3 B -P -4 C -P -5 Y -
  
Usage:
 
create_images [options] datafile percent.i2i prob.i2i
 
options:
 
  -o distance:    voxels within this distance count as overlapped.
 
  -n number:    number of voxels (1000000 default), see probcolocal.
 
  
Examples:
+
# run with some diagnostics:
  many_overlaps -t 100 1000 100 -T 100 1000 100 alpha_T.i2i beta_T.i2i tmp_output
+
cd /storage/big1/raz/GEDMAT/006_JTH/OM
  create_images -n 363264 tmp_output percent.i2i prob.i2i
+
/home/lml/krypton/bin/mask_gedmat_images.pl -tmpdir=/home/lml/krypton/Corvera/Raz -zip_ending=_Area.zip
+
        -results_ending=_Results.txt -combined_ending=combined.i2i -days=7:11
== Analysis of Points ==
+
        -save_day=/home/lml/krypton/Corvera/Raz/006_JTH_OM_7masks.i2i   > /home/lml/krypton/Corvera/Raz/006_JTH_OM.areas
=== components.pl -===
+
# play.FC14 allows labels to have comment lines (first character of line is a #)
 +
cd home/lml/krypton/Corvera/Raz
 +
play.FC14 -labels 006_JTH_OM_11masks.play_labels 006_JTH_OM_11masks.i2i
 +
chres_rpts.pl -sx=.33 -sy=.33 -truncate -min=1:1 output/_day11.rpts > _day11_bin3.rpts
 +
chres_rpts.pl -sx=.33 -sy=.33 -truncate -min=1:1 output/_day7.rpts > _day7_bin3.rpts
 +
chres_rpts.pl -sx=.33 -sy=.33 -truncate -min=1:1 output/_explant.rpts > _explant_bin3.rpts
 +
reduceima -bin 3 3 output/_day11_noex_halfex.i2i - | addlines - _day11_bin3.rpts - | addlines - _day7_bin3.rpts - |
 +
addlines - _explant_bin3.rpts - | play -P -1 R -
 +
addlines /storage/big1/raz/GEDMAT/006_JTH/OM/D07_20130524_GEDMAT_006_JTH_OM_DAY7_combined.i2i output/_day11.rpts - |
 +
addlines - output/_day7.rpts - | addlines - output/_explant.rpts - | reduceima -bin 3 3 -L - - | play -P -1 R -
  
Calculates the number of connected components resolved over a range of point densities.
 
  
components.pl [options]
+
# do a bunch of stuff
 +
analyze_gedmat3.pl # apply this perl script to lots of data
 +
cd output
 +
      play_results3.pl 006_JTH_OM_day7  # look at some of it
 +
raz_rates.pl # generate stats
 +
  
options:
 
  
-numpts=low:hi:delta
+
  source code: in /home/lml/krypton/bin/mask_gedmat_images.pl
-repeat=# number of times to repeat at each point density
 
-res=# in microns
 
-outfile=name name of output file. otherwise to _tmp. always need write permission in current directory.
 
  
 
   
 
   
===  convex_hull.pl -h ===
+
</nowiki>
 +
===  mask_gedmat_images4_new.pl  ===
 +
<nowiki>
 +
  mask_gedmat_images4_new.pl
 +
The easiest way to call this is via analyze_gedmat9.pl, see its help.
 +
 
 +
This version has the following changes compared with mask_gedmat_images3.pl:
  
This program takes an object outputfile (unless -rptsin or -tripletsin) produced by countobjs (or maskobjs) and finds the minimal
+
1. @stats = &outline_stats(@outline) was used to calculate explant center (for masking) but
spanning tree connecting the center of mass of the objects, and the convex hull. Writes out connections as an rpts file to stdout.
+
        the meanx and meany are just the mean of the outline, it is NOT a center of mass. usually ok for a compact explant.
It also loops through 20 thresholds  for the pts, and prints to stderr some stats about the minimal spanning tree and
+
  sub calc_com() is now used instead to calculate the true center of mass.
convex hull of the points above each of these thresholds.
+
-use_explant_outline will cause the OLD method to be used instead.
 +
 
 +
2.  bounding box was used to calculate area for sorting the outlines temporally (from smaller to larger area).
 +
      but when outlines intersect bounding box can at times NOT be a good surrogate for area.
 +
  $roi_area[$r] = ($maxx-$minx)*($maxy-$miny); 
 +
  handled these two issues by writing sub calc_com().
 +
-use_bbox_area will cause the OLD method to be used instead.
  
Options can be used to only selected a subset of the objects and to constrain the maximum distance (-maxdist).
 
  
It was written with the hope that triplets (maxima in an image which has a cell in the center) will show a pattern in their
+
note: fiji areas are already sorted smallest to largest when I first bring them in (extract_area2.pl does that):
convex hull area, so that when the threshold rises high enough, only maxima inside the cell will still be present and hence
+
  $prev_results = `extract_area2.pl -justfiles=$resultsfile`
the convex hull will be stable and of much smaller area.
+
  so I should do not need to use the sorted roi indices on them (so I've been doing this correctly). but the rpts are
 +
  being sorted based on bounding box, and fiji areas based on the true area in the Results.txt file. So the ordering
 +
  may be different at times. No change was made to this.
  
This program requires perl modules Graph::Kruskal and Math::Geometry::Planar, use cpanp to install these:
+
  mask_gedmat_images4.pl  -check_intersect  added.
    yum install perl-CPANPLUS-0.91.3-202.fc16.noarch  - for cpanp
+
determines when outlines intersect and sets the aerr (area error flag) in the
    cpanp -i Graph::Kruskal
+
output file. eventually it will calculate areas a different way when that happens
    cpanp i Math::Geometry::Planar
+
rather than combining masked images (see ~/krypton/Corvera/Raz/README for 10/18/13). right now only sets the error flag.
  
usage:
+
  Examines all the zip files (produced within fiji when outlining regions) in the current directory. These have
   convex_hull.pl -tripletsin file1.triplets > file1_mst.rpts
+
  the boundary of the explant, day7 growth, and day11 growth.
 +
  note: this program assumes that all the data in the directory is from the same patient and the same tissue type.
 +
 
 +
  It recalculates the area measures by only including that part of the day7 and day11 growth which is between the explant
 +
   center and going towards the center of the well; area from the explant center going away from the center of the
 +
  well (ie, growing towards the well wall) is excluded. By doing this, we hope to minimize the
 +
  effect of growth (as measured by area) being stopped by the well wall when the explant is near the well wall.   
 +
  Output is written to stdout. The comments there explain the fields. area_mex is the old value, area_mex_border is the new.
  
   input options:
+
   This is done by finding all the *_Area.zip files in the current directory, pulling out the outlines in those files
    -dx=#   spacing in the x direction, default = 1
+
  and using that information to recalculate areas.  It also needs to find the associated "combined" image file
    -dy=#   spacing in the y direction, default = 1
+
  (*_combined.i2i) to get image size and hence the position of the center of the well) and the fiji results file
    -dz=#   spacing in the z direction, default = 1
+
  (*_results.txt, so the numbers produced here can be easily compared with them).  
    -rptsin     instead of file1.objs, read file1.rpts where file1.rpts was produced by max2d.
 
      -size1 and -iod1 are ignored when this option is specified.
 
    -tripletsin   instead of file1.objs read in file1.xyi, triplets of x y and intensity.
 
  
   analysis options:
+
   note: The algorithm assumes that the area NEVER DECREASES with time, and that the explant region is always surrounded
    -size1=min:max     min and max object size allowed for file1.objs in pixels (inclusive)
+
by the day7 region which is surrounded by the day11 region. The latter assumption is sometimes invalid if
    -iod1=min:max   min and max object iod allowed for file1.objs (inclusive), or intensity if -tripletsin was specified.
+
the day 11 images were shifted relative to day 7 images; but that is usually ok.
    -maxdist=#: :  don't allow connections between pts further apart than this distance (after applying dx, dy, dz spacing factors).
+
(if necessary, you can manually change the "bad_data" field in the output file to 1 and then use
  warning: if the distance is too small, then all the pts will not be connected to begin with;
+
-cond in gedmat_to_xy.pl to eliminate those stats from further analysis.)
    this may cause the minimal spanning tree algorithm to fail.
+
It also assumes the smallest area in each zip file is the original explant area, the next largest area is
    default maxdist is  3000
+
called day7 area and the largest area (if 3 are present) is assumed to be day 11 area.
 +
Sometimes when growth is about 0, the outlines on, eg, day7, may have slightly less area than the original
 +
explant, so the outlines might be mis-ordered then. [actually it may read the correct day off the name of
 +
the i2i image now].
  
   output options:
+
   note: If only 2 areas (ie, two .roi files) are present in the zip file, they are assumed to be for
    -addlines :  output rpts format which addlines is more likely to be happy with (may not work in dave?)
+
the explant and day7 (not day11).
    -hist : calculate histogram of distances (hist[int(dist)]++, where int just truncates to integer). obsolete.
 
    -sizehist :  calculate histogram of object sizes (in voxels) in file1.out. (hist[int(size)]++, where int just
 
        truncates to integer). If you don't care about distances between two files (ie, only want -sizehist)
 
        put the same file name for both files on the command line.  obsolete.
 
    -rpts=file.rpts :  put bounding boxes around objects found and lines between closest objects (similar to objs2bb.pl)
 
  display this in dave eg:  dave -n 0 -u -I file.i2i file.rpts (use the -n 0 and -u options)
 
  note: may not show up in dave until you click on "scale" to force a rescale (or draw?).
 
    -jack=max.rpts:# :  create an rpts file with the maxima in each object displayed as a small jack.
 
    # controls the size of the jack. 1=1 pixel in size, 2 = 2 pixels, etc.
 
-twod   add this (in addition to -jack) if you want 2D jacks rather than 3D jacks.
 
    -strlim=# :  limit length of names of objects in rpts files to # characters.  dave sometimes crashes if the
 
        names are too long.
 
    -tyz :  transpose coords in yz before writing them to the rpts (must specify -rpts option)
 
    -color=# :  for the w value (color) use the specified value (use -P in play to see this as a color). default = none.
 
        if you have no color (no w value), addlines can put one in (-P option in addlines).
 
  
   diagnostics:
+
   note: This program assumes the center of the combined image (usually 4 well images are combined into one) is the
    -silent :  suppress warning messages.
+
center of the well. see combine_images.pl. It also assumes the combined image name ends in combined.i2i
    -verbose
+
(see -combined).
-debug
 
  
example:
+
  note: some of the scripts I use to then analyze these results will multiply the area by 2, to get a "true" estimate
   convex_hull2.pl -tripletsin -jack=jack.rpts:5 -addlines -twod -maxdist=100 file1.triplets > file1_mst.rpts
+
  of growth; since the value produced by mask_gedmat_images3.pl will be (roughly) half of the real growth rates.
   addlines2 -P -1 image.i2i file1_mst.rpts - | addlines2 -P -2 - jack.rpts - | reduceima -bin 3 3 -L - -| play -P -1 R  -P -1 G -
+
 
 +
   usage:
 +
mask_gedmat_images3.pl [options]
 +
 
 +
  options:
 +
-tmpdir=fullpathname directory to use for temporary files which are created, eg: -tmpdir=/home/lml/krypton
 +
 
 +
-zip_file=file.zip
 +
-zip_file=file.zip:file2.zip:...:filen.zip
 +
only examine the one specified zip file, not all those in the directory
 +
(If the second form is used, you can specify as many as you want.)
 +
note: you may still need to specify -zip_ending so that the ending of this file can be stripped
 +
      off correctly (so the -combined_ending and -results_ending can then be added correctly).
 +
-zip_ending=stuff e.g., -zipending=_area.zip . All files which end in this will be analyzed; default = _Area.zip
 +
-skip=file.zip[:file2.zip...]   list of zip files (without the full path) to skip.
 +
 
 +
-results_ending=stuff e.g., -results_ending=_results.txt  . This is what the -zip_ending should be replaced by
 +
to get the name of the associated fiji results file.  note the _ should be included here
 +
if it was included in -zip_ending.
 +
 
 +
-combined_ending=stuff  e.g., -combined_ending=_combined_reduced_.i2i  . default = combined.i2i.
 +
This is any string which helps identify the last part of the combined image filename.
 +
-combined_scaling=#:# e.g., -combined_scaling=2:2 if reduceima -bin 2 2 was applied to get _combined_reduced_.i2i.
  
 +
-scale=#:# distance and area (eg, -scale=2:4 if reduceima -bin 2 2 was used) scaling. This will multiply
 +
the area stored in the fiji file and the area calculated via my mask by the second number.
 +
The first number will multiply the distance of the explant from the center of the image.
 +
This option is just here to handle 001_BAP and 002_PRO datasets. They were analyzed in fiji
 +
with the images reduced by a factor of 2 in x and y. So the fiji areas produced will be low
 +
by 4x, as will my areas.  This option compensates for that.  See ~/Corvera/Raz/README for 10/11/13.
  
see also:
+
-check_intersect check if outlines intersect with the explant's outline. If so, set an error flag on stdout printout
  convex_hull, objs2mst.pl
+
and print info to stderr.  eventually will just use area numbers rather than masking area in this situation.  
  objs2bb.pl, objs2dist.pl, objs2dist121.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent
+
that is not done yet ...  
  resolve_pts
 
  
 
===  objs2alldists.pl  -h  ===
 
Like obs2disp.pl but calculates the distance to ALL the objects (within -maxdist), not just the closest.
 
See ~/krypton/Zhuge/grants/AsthmaRO1/README for 5/27/11 and /home/lml/krypton/Zhuge/BKandRyr/analysis6/run18
 
  (which did NOT use this).
 
  
This program takes 2 object outputfiles produced by countobjs (or maskobjs) and finds the shortest distance
+
-save_day[=directory]
from the center of mass of objects in file1.out to the center of mass of objects in file2.out.
+
saves the final binary mask for each days growth (eg, day7 growth minus the explant and minus the part growing towards the wall)
 +
into a 3d mask image (patientid_tissue_day#_mask.i2i).  This image will be reduced down in xdim and ydim from the
 +
original.  patientid_tissue_day#_.play_labels will also be created (labels which well each z slice comes from).
 +
This is mostly for quality control purposes.
 +
In addition, patientid_tissue_day#.rpts will be created (similarly reduced down in size) (coords may be off by 1?).
 +
View the file via: addlines maskim.i2i maskim.rpts -  |play.FC14 -P -1 R -labels maskim.play_labels -
 +
  or via: play_results3.pl
 +
patientid_tissue_day#_orig.i2i will be the original images (also reduced in xdim and ydim, and only one 2d slice
 +
from each original 3d image).
 +
note: older versions of play may need the comment line at the top of maskim.play_labels removed.
 +
note: if you want images to be in another directory, specify a full pathname, eg -save_day=/home/lml/krypton (without last /).
 +
note: any existing file with these names will be OVER-WRITTEN.
 +
note: this option creates lots of temporary files (in tmpdir) of the form __*.i2i, any existing
 +
      files that match this will be DELETED.  
 +
see also: montage
  
If both file arguments are the same (e.g., objs2dist.pl file1.out file1.out >file.dist), you can use this
+
-patient5 patient5 files have some odd naming. use this option if analyzing them.
routine to find the distances between objects within an image (an object match with the same id is automatically
 
ignored in this case so objects don't match to themselves). See also the option -skipsame.
 
  
(modified from /storage/big1/lml/was_voxel/Corvera/track/objs2bb.pl)
+
-use_explant_outline legacy. specify this if you want the center of the explant to be based on the average of the pixel positions
 +
of just the pixels along the boundary (rather than the center of mass).
 +
-use_bbox_area legacy. specify this if you want to order the outlines based on their bounding box area rather than their true area.
 +
You should probably specify both options (if you want either one), I'm not sure about consistency if only one is specified.
  
usage:
+
-just_check just check whether each zip roi outline has the correct number of associated image files.
  objs2alldists.pl file1.out file2.out >file.dist  
+
eg, if the zip file has 3 outlines (explant, firstday, secondday) there should be two i2i files with DAY# in their name.
 +
prints to stderr info about those which don't have the correct number. does nothing else.
 +
-just_stats goes a bit further than -just_check (does that too), sets -verbose and prints out stats about each outline. then exits.
 +
-verbose some extra info to stdout
 +
-debug prints some tracing info to stderr
 +
-print_fname print name of each zip file as it is being analyzed, to stderr.
 +
-dlevel=# extra debugging. the bigger the number the more the printout. # is an integer starting at 1.
 +
-dlevel=1 will print a trace of commands to execute to mimic (parts of) this perl script.
 +
-noclean don't remove the temporary files which were created
 +
the files are: _ones.i2i _explant.rpts _day11.rpts _day7.rpts _excluded_region.rpts
 +
      _explant.i2i _day11.i2i  _day7.i2i _day7_noex.i2i _day11_noex.i2i _day7_noex_halfex.i2i _day11_noex_halfex.i2i
 +
  (if multiple zip files were analyzed, only the files from the last one will be left, since they get reused)
 +
-dont_recalc only for diagnostics. does NOT restrict the analysis to just the growth away from the wall.
 +
with this specified this entire program should just reproduce the numbers we already
 +
have in *Results.txt since that uses the entire area. ie, this make the program a no-op.
  
options:
+
   see also:
   -dx=# :  spacing in the x direction ,default = 1
+
/home/lml/krypton/Corvera/Raz/README
  -dy=# :  spacing in the y direction ,default = 1
+
analyze_gedmat3.pl a script which calls mask_gedmat_images3.pl for all of Raz's data. Also versions 4,5,6, and 7.
  -dz=# :  spacing in the z direction ,default = 1
+
play_results3.pl
  -size1=min:max :  min and max object size allowed for file 1 in pixels (inclusive)
+
raz_rates.pl
  -size2=min:max : min and max object size allowed for file 2 in pixels (inclusive)
+
mask_gedmat_images.pl
  -iod1=min:max :  min and max object iod allowed for file 1 (inclusive)
+
mask_gedmat_images2.pl
  -iod2=min:max :  min and max object iod allowed for file 2 (inclusive)
+
/storage/big1/raz/GEDMAT/
  -maxdist=#: :  don't allow matches further away than this distance (after applying dx, dy, dz spacing factors).
+
ReadROI.pl
  default maxdist is ~  3000.
+
extract_area.pl
  -hist :  calculate histogram of distances (hist[int(dist)]++, where int just truncates to integer).
+
combine_images.pl
  -sizehist :  calculate histogram of object sizes (in voxels) in file1.out. (hist[int(size)]++, where int just
+
gedmat_to_xy.pl
  truncates to integer). If you don't care about distances between two files (ie, only want -sizehist)
+
/home/lml/krypton/Corvera/Raz/analyze_gedmat.pl
  put the same file name for both files on the command line.  
+
chres_rpts.pl
  -rpts=file.rpts :  put bounding boxes around objects found and lines between closest objects (similar to objs2bb.pl)
+
  filter_rptsinz.pl
  display this in dave eg:  dave -n 0 -u -I file.i2i file.rpts (use the -n 0 and -u options)
 
  note: may not show up in dave until you click on "scale" to force a rescale (or draw?).
 
  -jack=max.rpts:# :  create an rpts file with the maxima in each object displayed as a small jack.
 
  # controls the size of the jack. 1=1 pixel in size, 2 = 2 pixels, etc.
 
  -strlim=# :  limit length of names of objects in rpts files to # characters. dave sometimes crashes if the
 
  names are too long.
 
  -tyz :  transpose coords in yz before writing them to the rpts (must specify -rpts option)
 
  -skipsame :  don't match an object in file1.out to an object with the same id in file2.out
 
  This is set automatically if file1.out = file2.out.
 
  -silent :  don't print the distances (sets -hist)
 
  -simpleprint :  when printing distances, just print distance, one per line, nothing else. to be read in
 
  by ~/Zhuge/grants/AsthmaRO1/distance_distribution.m. note: that program assumes distances
 
  are in pixels and pixels are 80 nm, unless you specify pixelsize=somethingelse.
 
  -simpleprint2 :  like simpleprint, but the first column is id of the Ryr to which this BK is closest.
 
  -onelineprint :  like objs2alldists.pl but prints the distance to ALL the objects (within -maxdist),
 
  not just the closest on one line, so we can keep track of which BK are near which Ryr.
 
  see comdists3.pl (which uses this option).
 
  -verbose
 
  
example:
+
  examples:
  countobjs -k -t 2000 2000 wave1.objs wave1.i2i
+
cd /storage/big1/raz/GEDMAT/006_JTH/OM
  countobjs -k -t 2000 2000 wave2.objs wave2.i2i
 
  objs2dist.pl wave1.objs wave2.objs > wave1and2.dist
 
  
see also:
+
# generate 006_JTH_OM.areas with all the data (area_mex_border is the number which should replace farea)
   objs2dist121.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent, pt_distances
+
# also produce 006_JTH_OM_7masks.i2i and 006_JTH_OM_11masks.i2i so I can check on the validity of the algorithm.
 +
# place diagnostic mask images in /home/lml/krypton/Corvera/Raz/output and the output data file in
 +
# /home/lml/krypton/Corvera/Raz (note: all directories must already exist).
 +
mask_gedmat_images.pl -tmpdir=/home/lml/krypton/Corvera/Raz/output  -zip_ending=_Area.zip -results_ending=_Results.txt
 +
-combined_ending=combined.i2i -days=7:11
 +
-save_day=/home/lml/krypton/Corvera/Raz/output
 +
>& /home/lml/krypton/Corvera/Raz/006_JTH_OM.areas
 +
 
 +
# look at the masks produced:
 +
cd /home/lml/krypton/Corvera/Raz/output
 +
      play_results3.pl 006_JTH_OM_day7
 +
or:
 +
fgrep -v # 006_JTH_OM_11masks.play_labels > tmp.play_labels   # eliminate the comment line, play doesn't like those.
 +
play -labels tmp.play_labels 006_JTH_OM_7masks.i2i
 +
 
 +
# compare the full areas produced which what fiji did (as a check). only pull out the good data. they should be very similar:
 +
cd /home/lml/krypton/Corvera/Raz
 +
gedmat_to_xy.pl -cond='if (($date eq "date_sure")&&($perr==0)&&($aerr==0)) {1;} else {0;}'
 +
-xcoord='$area' -ycoord='$farea' 006_JTH_OM.areas | xmgrace -free -pipe
 +
 
 +
# now grab the data we really want. compare the old way, with the area when the growth half near the well border is masked off:
 +
gedmat_to_xy.pl -cond='if (($date eq "date_sure")&&($perr==0)&&($aerr==0)) {1;} else {0;}' 
 +
-xcoord='$area_mex' -ycoord='$area_mex_border' 006_JTH_OM.areas | xmgrace -free -pipe
 +
 
 +
# it may be hard to see some of these images as they are very large, do it this way (note the -L to keep the -1 boundary values):
 +
addlines _ones.i2i _excluded_region.rpts - | reduceima -bin 3 3 -L - -|play -P -1 R -P -2 G -P -3 B -P -4 C -P -5 Y -
 +
 
 +
 
 +
# run with some diagnostics:
 +
cd /storage/big1/raz/GEDMAT/006_JTH/OM
 +
/home/lml/krypton/bin/mask_gedmat_images.pl -tmpdir=/home/lml/krypton/Corvera/Raz -zip_ending=_Area.zip
 +
        -results_ending=_Results.txt -combined_ending=combined.i2i -days=7:11
 +
        -save_day=/home/lml/krypton/Corvera/Raz/006_JTH_OM_7masks.i2i    > /home/lml/krypton/Corvera/Raz/006_JTH_OM.areas
 +
# play.FC14 allows labels to have comment lines (first character of line is a #)
 +
cd home/lml/krypton/Corvera/Raz
 +
play.FC14 -labels 006_JTH_OM_11masks.play_labels 006_JTH_OM_11masks.i2i
 +
chres_rpts.pl -sx=.33 -sy=.33 -truncate -min=1:1 output/_day11.rpts > _day11_bin3.rpts
 +
chres_rpts.pl -sx=.33 -sy=.33 -truncate -min=1:1 output/_day7.rpts > _day7_bin3.rpts
 +
chres_rpts.pl -sx=.33 -sy=.33 -truncate -min=1:1 output/_explant.rpts > _explant_bin3.rpts
 +
reduceima -bin 3 3 output/_day11_noex_halfex.i2i - | addlines - _day11_bin3.rpts - | addlines - _day7_bin3.rpts - |
 +
addlines - _explant_bin3.rpts - | play -P -1 R -
 +
addlines /storage/big1/raz/GEDMAT/006_JTH/OM/D07_20130524_GEDMAT_006_JTH_OM_DAY7_combined.i2i output/_day11.rpts - |
 +
addlines - output/_day7.rpts - | addlines - output/_explant.rpts - | reduceima -bin 3 3 -L - - | play -P -1 R -
 +
 
 +
 
 +
# do a bunch of stuff
 +
analyze_gedmat3.pl # apply this perl script to lots of data
 +
cd output
 +
      play_results3.pl 006_JTH_OM_day7  # look at some of it
 +
raz_rates.pl # generate stats
 +
 +
 
 +
 
 +
  source code: in /home/lml/krypton/bin/mask_gedmat_images.pl
  
 
   
 
   
===  objs2dist2.pl -h ===
+
</nowiki>
objs2dist2.pl: like objs2dist.pl but when -rpts specified prints out lines to ALL objects
+
===  membrane3D.pl  ===
      within -maxdist (which now defaults to 20), rather than just the closest.
+
<nowiki>
      So we can see all the BK clusters which are close enough
+
 
      to a Ryr to be activated. see /home/lml/krypton/Zhuge/paper2010/README for 5/20/10.
+
A script to run the routines necessary to perform 3D membrane segmentation.
 +
note: it needs write permission in the directory where inputimage.i2i resides since all output images go there too.  
 +
It will run the following programs, in order:
 +
  1. /home/lml/krypton/facil/i2i2mhd (convert to mhd format)
 +
  2. /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/cellPreprocess (median filter, fill holes)
 +
  3. /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/resample (resample pixel sizes)
 +
  4. /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/multiscalePlateMeasureImageFilter  (determine the planarity of each region)
 +
  5. /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/membraneVotingField3D (update planarity based on neighbors voting)
 +
  6. /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/membraneSegmentation  (produce segmented regions via a watershed algorithm)
 +
Each program expects input files of a certain type (e.g. unsigned char).
 +
 
 +
 
 +
usage:
 +
  membrane3D.pl [options] inputimage.[i2i|mhd|mha] outimage.mhd
 +
 
 +
output files:
 +
  inputimage.mhd produced by i2i2mhd  - short ints
 +
  inputimage_med.mhd produced by cellPreprocess
 +
  inputimage_med_resamp.mhd produced by resample, unsigned char
 +
  inputimage_med_resamp_planar.mhd produced by multiscalePlateMeasureImageFilter, floating pt (doubles) between 0 and 1, how "planar" a pt is.
 +
  inputimage_med_resamp_eigen.mhd produced by multiscalePlateMeasureImageFilter, an eigenmatrix at each pt
 +
  inputimage_med_resamp_eigen_voting.mhd produced by membraneVotingField3D, result of voting, unsigned char
 +
  outimage.mhd produced by membraneSegmentation,  result of watershed, each region labeled with an id (short integer).
 +
 
 +
note: all units below are in the same units as the pixel units (I think). So if pixel spacing is 2 (um) in x, and a radius
 +
      of 2 is specified, that is a one pixel radius.  
  
This program takes 2 object outputfiles produced by countobjs (or maskobjs) and finds the shortest distance
+
step 1. options for converting i2i to mhd:
from the center of mass of objects in file1.out to the center of mass of objects in file2.out.
+
  -convert=dx:dy:dz  The first step is converting our i2i format to mhd format.  This specifies the pixel spacing
 +
in x y and z directions for that. default assumes 1:1:1. The "conversion" really just creates inputimage.mhd which
 +
is a text header which points to the original i2i image and gives some info about it. 
 +
If the input image has a .mhd or .mha extension already (instead of .i2i) then no conversion is done.
 +
Olga's images acquired with a 10x objective have a pixel size of .645 um/pixel (and z spacing of 10 um).
 +
Example: G03_x_1_1_binned.i2i has a pixel size of 2.5x2.5x10.  So -convert=2.5:2.5:10 specifies this in the mhd header.
  
If both file arguments are the same (e.g., objs2dist.pl file1.out file1.out >file.dist), you can use this
+
step 2. options for cellPreproces:
routine to find the distances between objects within an image (an object match with the same id is automatically
+
this may produce an unsigned char image (?)
ignored in this case so objects don't match to themselves). See also the option -skipsame.
+
  -median=# radius of median filtering preprocessing (and hole filling). If this is not specified it isn't done.
  
(modified from /storage/big1/lml/was_voxel/Corvera/track/objs2bb.pl)
+
step 3. options for resampling:
 +
this may produce an unsigned char image (?)
 +
  -resample=x:y:z  resample in the x y and z directions, eg. -resample=2:2:1 will halve the x and y dimensions and leave z unchanged.
 +
note: this will change the spacing between the pixels; but the routines which follow will understand that.
 +
For example: if after resampling, the pixels are spaced 10 um apart, then -planar=10 will use a sigma of 1 pixel.
 +
If this is not specified it isn't done.
  
usage:
+
  note: it may be necessary to do the above operations, which also convert the image into unsigned char, which is required for
  objs2dist2.pl file1.out file2.out >file.dist 
+
step 4, multiscalePlateMeasureImageFilter?
 +
  note: step 6 (watershed) may also work best if the pixel sizes are the same in all directions.
  
options:
+
step 4. options relating to planarity:
  -dx=# :  spacing in the x direction ,default = 1
+
the planarity image produced will be doubles from 0-1.
  -dy=# :  spacing in the y direction ,default = 1
+
  -planar=# the sigma of the Gaussian used when classifying pixels as planar or not. default = 1
  -dz=# :  spacing in the z direction ,default = 1
+
  -alpha=# see the help for /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/multiscalePlateMeasureImageFilter
  -size1=min:max :  min and max object size allowed for file 1 in pixels (inclusive)
+
  -beta=# ditto
  -size2=min:max :  min and max object size allowed for file 2 in pixels (inclusive)
+
  -gamma=# ditto
  -iod1=min:max :  min and max object iod allowed for file 1 (inclusive)
+
  -c=# ditto
  -iod2=min:max :  min and max object iod allowed for file 2 (inclusive)
+
  -planaropts="options for multiscalePlateMeasureImageFilter here" 
  -maxdist=#: :  don't allow matches further away than this distance (after applying dx, dy, dz spacing factors).
+
available options (so far, but anything specified here will be passed), : -a # -b # -g # -c # -d -s -B -T
  default maxdist is 20.
+
options which go here should be specified in the format that multiscalePlateMeasureImageFilter wants them,
  -hist : calculate histogram of distances (hist[int(dist)]++, where int just truncates to integer).
+
for example: -planaropts="-c 5 -d -B"
  -sizehist :  calculate histogram of object sizes (in voxels) in file1.out. (hist[int(size)]++, where int just
+
not in the alternative format that Membrane3D.pl desires (e.g. -planaropts="-a 5" is correct, -planaropts="-alpha=5" is wrong).
  truncates to integer). If you don't care about distances between two files (ie, only want -sizehist)
+
    -stop_after_planar don't do anything after this step (e.g. voting for planar patches may not make sense if -B or -T specified)
  put the same file name for both files on the command line.
+
 
  -rpts=file.rpts :  put bounding boxes around objects found and lines from objects in file1.out to all objects
+
step 5. options relating to voting:
  in file2.out that are <= maxdist away (these lines will become an object named "near_to_file1.out").
+
the resulting tensor vote image will be unsigned chars from 0-255.
  display this in dave eg:  dave -n 0 -u -I file.i2i file.rpts (use the -n 0 and -u options)
+
  -region=# the sigma which defines the region within which a pixel influences other pixels. default = 10
  note: may not show up in dave until you click on "scale" to force a rescale (or draw?).
+
 
  -jack=max.rpts:# :  create an rpts file with the maxima in each object displayed as a small jack.  
+
step 6. options relating to watershed segmentation:
  # controls the size of the jack. 1=1 pixel in size, 2 = 2 pixels, etc.
+
The resulting image will be long ints (id numbers) of regions.   
  -strlim=# : limit length of names of objects in rpts files to # charactersdave sometimes crashes if the
+
                See the help for /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/membraneSegmentation
  names are too long.
+
  -thresh=# threshold value. this is applied to the tensor voting image to turn it into a binary image. then a  distance
  -tyz :  transpose coords in yz before writing them to the rpts (must specify -rpts option)
+
transform and watershed are applied. default = 128
  -skipsame :  don't match an object in file1.out to an object with the same id in file2.out
+
  -segopts="options for membraneSegmentation here"   
  This is set automatically if file1.out = file2.out.
+
for example:  -segopts="-S -l 20 -a 5 -c -D" will use this exact string as options.
  -silent don't print the shortest distances (sets -hist)
+
options so far: -S -l # -a # -s # -n -i # -w # -m # -c -v -d -D
  -verbose
 
  
 +
other options:
 +
  -verbose echo what is being done to stderr
 +
  -dummy don't really do anything; echo what would have been done to stderr.
 +
 
 
example:
 
example:
  countobjs -k -t 2000 2000 wave1.objs wave1.i2i
+
reduceima -bin 4 4 G03_x_1_1.i2i G03_x_1_1_binned.i2i    - go from .645um/pixel, 10um in z -> 2.5um/pixel, 10um in z
  countobjs -k -t 2000 2000 wave2.objs wave2.i2i
+
# -convert: just put correct pixel size info into an mhd header
  objs2dist2.pl wave1.objs wave2.objs > wave1and2.dist
+
# -median:  smooth with a filter 10 um (4 pixels, since they are now 2.5um/pixel) in radius (diameter?)
 +
# -resample: change to a square pixel (10 um in x y and z). Change image format to unsigned char (needed by MultiscalePlateMeasureImageFilter)
 +
# -planaropts: options for planarity filter
 +
# -region:  width (in um) of neighbors for voting on planarity and updating it.
 +
# -segopts:
 +
# -thresh:  threshold for watershed segmentation
 +
membrane3D.pl -convert=2.5:2.5:10 -median=10 -resample=2:2:1 -planaropts="  " -region=50 -segopts="  "  -thresh
 +
G03_x_1_1_binned.i2i G03_x_1_1_results.mhd
  
see also:
+
see also: /home/lml/krypton/segmentation/MR-Source/ACME/lmltest/README
  objs2dist121.pl, objs2dist.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent, pt_distances
+
  /home/lml/krypton/segmentation/FindingCellMembranesIn3D.pdf
 +
          i2i2mhd - convert i2i into mhd format
 +
  mhd2i2i - convert an mhd image (but not an eigenimage)
 +
  RegionId2Mesh - will convert the ID image produced into a mesh image or rpts file
 +
  mayavi2  - to visualize *.mha and *.mhd files.
 +
  Fiji - my version has a File-> Import metaimage  plugin
  
 
   
 
   
===  objs2mst.pl -h ===
+
</nowiki>
 +
===  Norio_stats.pl  ===
 +
<nowiki>
 +
 
 +
This programs takes each pts file in the current directory, thresholds the associated vinculin image,
 +
applies that mask to the trip6 image, and produces a .coloc file from the masked trip6 image (using mask_and_coloc.pl);
 +
overlap statistics are then calculated (and put into a file name *_masked.coloc where * is the root of the trip6 image name)
 +
and finally the highest ratio data from each image pair is printed to stdout (using sort_overlap3.pl).
  
This program takes an object outputfiles (unless -rptsin) produced by countobjs (or maskobjs) and finds the minimal
+
stats.pl [options]  > stats.out
spanning tree connecting the center of mass of the objects. Writes out connections as an rpts file to stdout.
+
  -nothing : do nothing, just echo what would be done
Options can be used to only selected a subset of the objects and to constrain max distance (so multiple
+
  -h : print this help
trees can be produced).
+
  -thresh=#    : threshold for the vinculin image. default = 20
 +
  -regions=#:#  : only allow mask regions within the specified min:max size (in pixels, inclusive).
 +
: Also creates *_count.i2i  and *.countobjs  (* = root of vinculin image name) intermediate files.
 +
: note: these counts are for the vinculin image after the mask (pts file) is applied.
 +
  -clean:      : clean up (ie, remove) *_count.i2i and *.countobjs images (if -regions specified)
 +
 
 +
 +
</nowiki>
 +
===  run2_Ronghua.pl  ===
 +
<nowiki>
 +
 
 +
this program goes through Ronghua's directory (see -dir option)
 +
analyzing files.  output is put into the current working directory (ie, the directiory
 +
run.pl is run from).
 +
A tag in the name of the form Ryr_thresh_minsize_maxsize_Bk_thresh_minsize_maxsize
 +
is added to the output name  of name.patchdist  (nearest voxel distance between whole
 +
patches) and name.comdist (distances between nearest center of mass of the patches).
  
 
usage:
 
usage:
   objs2mst.pl file1.objs  > file1_mst.rpts
+
   run.pl [options]
  
 
options:
 
options:
   -dx=# : spacing in the x direction, default = 1
+
   -dir=directorypath    : without the final slash. directory to analyze. default = /mnt/big3/rzg/mtc/immunocytochemistry/july05/imcc/70105/epr
   -dy=# : spacing in the y direction, default = 1
+
   -ryrthresh=# : threshold for ryr (488) images, default =  
   -dz=# : spacing in the z direction, default = 1
+
   -min_ryrsize=# : minimum allowed object size in pixels, default = 5
   -size1=min:max :  min and max object size allowed for file1.objs in pixels (inclusive)
+
   -max_ryrsize=# : max allowed object size in pixels, default = 150
   -iod1=min:max : min and max object iod allowed for file1.objs (inclusive)
+
   -min_ryriod=# : minimum allowed object iod, default = 354
   -rptsin : instead of file1.objs, read file1.rpts where file1.rpts was produced by max2d.
+
   -max_ryriod=# : maximum allowed object iod, default = 10000000
  -size1 and -iod1 are ignored when this option is specified.
+
 
   -addlines : output rpts format which addlines is more likely to be happy with (may not work in dave?)
+
   -bkthresh=# : threshold for bk (594) images, default =
   -maxdist=#: : don't allow matches further away than this distance (after applying dx, dy, dz spacing factors).
+
   -min_bksize=# : minimum allowed object size in pixels, default = 5
  default maxdist is ~  3000.
+
   -max_bksize=# : max allowed object size in pixels, default = 50
   -hist : calculate histogram of distances (hist[int(dist)]++, where int just truncates to integer).
+
   -min_bkiod=# : minimum allowed object iod, default = 4686
   -sizehist : calculate histogram of object sizes (in voxels) in file1.out. (hist[int(size)]++, where int just
+
   -max_bkiod=# : maximum allowed object iod, default = 10000000
  truncates to integer). If you don't care about distances between two files (ie, only want -sizehist)
+
 
  put the same file name for both files on the command line.
+
   -dx=# : relative distance in x, default = 1  
   -rpts=file.rpts : put bounding boxes around objects found and lines between closest objects (similar to objs2bb.pl)
+
   -dy=# : relative distance in y, default = 3
  display this in dave eg:  dave -n 0 -u -I file.i2i file.rpts (use the -n 0 and -u options)
+
   -dz=# : relative distance in z, default = 1
  note: may not show up in dave until you click on "scale" to force a rescale (or draw?).
+
 
   -jack=max.rpts:# : create an rpts file with the maxima in each object displayed as a small jack.
+
  -noclean
  # controls the size of the jack. 1=1 pixel in size, 2 = 2 pixels, etc.
+
   -debug
   -strlim=# :  limit length of names of objects in rpts files to # characters.  dave sometimes crashes if the
 
  names are too long.
 
  -tyz : transpose coords in yz before writing them to the rpts (must specify -rpts option)
 
   -color=# : for the w value (color) use the specified value (use -P in play to see this as a color). default = none.
 
  if you have no color (no w value), addlines can put one in (-P option in addlines).
 
   -silent :  don't print the shortest distances (sets -hist)
 
 
   -verbose
 
   -verbose
  
example:
+
   countobjs -k -t 2000 2000 wave1.objs wave1.i2i
+
</nowiki>
   objs2mst.pl wave1.objs  > wave1mst.rpts
+
===  countobjs  ===
   dave -I wave1.i2i -n 0 -u wave1mst.rpts
+
<nowiki>
 +
Usage:
 +
   countobjs [options] outputfile image1.i2i [image2.i2i]
 +
Description:
 +
  Count objects in co-localized images. If only one image given
 +
  the objects will be counted in that one image.  Copious amounts
 +
  of information will be written to the output file.
 +
  A - for outputfile will write to stdout.
 +
  outpufile can be analyzed with objs2bb.pl and objs2dist.pl
 +
 
 +
Options:
 +
  -C # #        : set opacity and brightness level to these values (0-255 only)
 +
  -k             : use original images for data analysis (so scale and black level not important and
 +
      -t option can be in same units as original, unscaled, image values)
 +
  -S # # #      : image # scale and black level (default autoscale image)
 +
  -r # # # # # # : region of image to count
 +
                  (-r x0 y0 z0    x1 y1 z1)
 +
                  (  ^lower left  ^upper right)
 +
                  (zero indexed coordinates)
 +
                  (default whole image)
 +
  -s # #        : size of smallest and largest objects to count
 +
                  (default 1-100000)
 +
  -m # #        : min and max iod of allowable objects (applied to image1 only).
 +
  -t thresh1 thresh2    : thresholds (applied after -S or default scaling, unless -k specified).
 +
                  Like left brightness slider in DAVE.
 +
                  if only one image, second number still required, but ignored.
 +
  -o <image.i2i> : output image with all objects represented by the voxel
 +
                  with the maximum intensity in the object
 +
                  the intensity of the voxel will be the IOD of the object.
 +
   -O <image.i2i> : output image with all pixels in each object having
 +
                  the intensity of the original objects IOD.
 +
                  NOTE: this image will be in floating point format.
 +
                        use float2int to convert it back to "normal" format.
 +
   -Q <image.i2i> : output image with all pixels in each object having
 +
                  a unique id # (1-# of objects). Must be < 32766 objects.
 +
                  NOTE: this image will be in standard signed short int format.
 +
  -M #          : When countobjs is given 2 images, this flag will
 +
                  turn of some subset of the voxels for colcalization.
 +
                  calculations.
 +
                  0: turn off colcalized voxels (default on)
 +
                  1: turn off image 1 voxels (default on)
 +
                  2: turn off image 2 voxels (default on)
 +
  -q     : quiet. don't print out all objects, but just summary statistics
 +
  -Z            : simple analysis, no sliders, opacity,etc. can use with -t option.
 +
  -h            : show this message.
 +
  -H            : show even more help.
  
see also:
+
Notes:
   objs2bb.pl, objs2dist.pl, objs2dist121.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent
+
   A - in place of an image name means stdin or stdout.
   resolve_pts
+
   Source code in /storage/big1/lml/jac/was_invitro/Projects/countobjs
  
 
===  objs_within_dist.pl  -h  ===
 
  
This program takes 2 object outputfiles produced by countobjs (or maskobjs) and finds the number of objects
+
</nowiki>
in the second file which are within a given distance of each object in the first file.  A histogram is
+
===  countobjsmax3d  ===
printed out.
+
<nowiki>
Distances are from the center of mass of objects in file1.out to the center of mass of objects in file2.out.
+
Usage:
(modified from objs2dist.pl)
+
  countobjsmax3d [options] -Q imageid.i2i outputfile image1.i2i
 +
Description:
 +
  This version of countobjs finds 3d maxima in image1.i2i, then finds all pixels connected
 +
  to each maxima and downhill from it.  These are labelled with a unique id number and stored
 +
  in imageid.i2i (specified with the -Q option, which is REQUIRED for this version)
 +
  You may want to display imageid.i2i after using colorize_image on it.
 +
  Not tested yet.
  
usage:
+
  Count objects in co-localized images. If only one image given
   objs_within_dist.pl file1.out file2.out >file.dist 
+
  the objects will be counted in that one image.  Copious amounts
 +
   of information will be written to the output file.
 +
  A - for outputfile will write to stdout.
 +
  outpufile can be analyzed with objs2bb.pl and objs2dist.pl
  
options:
+
Options:
   -dx=# spacing in the x direction ,default = 1
+
   -r # # # # # # : region of image to count
   -dy=# : spacing in the y direction ,default = 1
+
                  (-r x0 y0 z0    x1 y1 z1)
   -dz=# : spacing in the z direction ,default = 1
+
                  (  ^lower left ^upper right)
   -size1=min:max : min and max object size allowed for file 1 in pixels (inclusive)
+
                  (zero indexed coordinates)
   -size2=min:max : min and max object size allowed for file 2 in pixels (inclusive)
+
                  (default whole image)
  -iod1=min:max : min and max object iod allowed for file 1 (inclusive)
+
   -s # #         : size of smallest and largest objects to count
  -iod2=min:max : min and max object iod allowed for file 2 (inclusive)
+
                  (default 1-100000)
   -maxdist=#: don't allow matches further away than this distance (after applying dx, dy, dz spacing factors).
+
   -m # #         : min and max iod of allowable objects (applied to image1 only).
  default maxdist is ~  3000.
+
  -t thresh1 thresh2    : thresholds (applied after -S). Like left brightness slider in DAVE.
   -rpts : read in file in rpts format
+
                  if only one image, second number still required, but ignored.
   -verbose : extra info written to stderr
+
   -o <image.i2i> : output image with all objects represented by the voxel
   -vverbose : print other info. can be combined with -verbose.
+
                  with the maximum intensity in the object
 +
                  the intensity of the voxel will be the IOD of the object.
 +
  -O <image.i2i> : output image with all pixels in each object having
 +
                  the intensity of the original objects IOD.
 +
                  NOTE: this image will be in floating point format.
 +
                        use float2int to convert it back to "normal" format.
 +
  -Q <image.i2i> : output image with all pixels in each object having
 +
                  a unique id # (1-# of objects). Must be < 32766 objects.
 +
                  NOTE: this image will be in standard signed short int format.
 +
   -M #          : When countobjs is given 2 images, this flag will
 +
                  turn of some subset of the voxels for colcalization.
 +
                  calculations.
 +
                  0: turn off colcalized voxels (default on)
 +
                  1: turn off image 1 voxels (default on)
 +
                  2: turn off image 2 voxels (default on)
 +
   -q     : quiet. don't print out all objects, but just summary statistics
 +
   -Z            : simple analysis, no sliders, opacity,etc. can use with -t option.
 +
   -h            : show this message.
 +
   -H            : show even more help.
  
example:
+
Notes:
   countobjs -k -t 2000 2000 wave1.objs wave1.i2i
+
   A - in place of an image name means stdin or stdout.
   countobjs -k -t 2000 2000 wave2.objs wave2.i2i
+
   Source code in /storage/big1/lml/jac/was_invitro/Projects/countobjs
  objs_within_dist.pl wave1.objs wave2.objs > wave1and2.dist
 
  
see also:
+
 
   objs2dist121.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent, pt_distances
+
</nowiki>
 +
===  threshold.pl  ===
 +
<nowiki>
 +
threshold.pl -numvox=#  [-produce=newimage.i2i] image.i2i
 +
 
 +
calculate the largest threshold for image.i2i which has at least # voxels
 +
equal or above it.  Prints the threshold and the number above threshold to stdout.
 +
 
 +
options:
 +
 
 +
   -produce=newimage.i2i    : take the calculated threshold, apply it to image.i2i to produce newimage.i2i
 +
 
 +
 +
</nowiki>
 +
===  thresholdz.pl ===
 +
<nowiki>
 +
thresholdz.pl -numvox=#  [-produce=newimage.i2i] image.i2i
 +
 
 +
calculate the largest threshold for image.i2i which has at least # voxels
 +
equal or above it.  Prints the threshold and the number above threshold to stdout.
 +
 
 +
options:
 +
 
 +
  -produce=newimage.i2i    : take the calculated threshold, apply it to image.i2i to produce newimage.i2i
  
 
   
 
   
===  connected_random_pts  -h ===
+
</nowiki>
Generates random pts in a planar region, calculates how many connected components are created
+
===  2Ddistances ===
if a pt is connected to all other pts within a given radius.
+
<nowiki>
 +
 
 +
Calculates a histogram of the amount of light as a function of distance from boundary (0 valued) voxels as specified in the mask.
 +
Applies a 2D mask to a 2D time series.
  
 
Usage:
 
Usage:
connected_random_pts [options]
+
2Dhistogram [options] inimage.i2i inmask.i2i
 
Options:
 
Options:
-x lowx hix:         pts have xcoords within this range, default = (0.0,100.0)
 
-y lowy hiy:         pts have ycoords within this range, default = (0.0,100.0)
 
-r #: radius (in pixels), default = 5.0
 
-s #: long int starting seed for random number generator. default = process id.
 
-n #: number of pts to create, default = 1000
 
  -h: help
 
 
   -v: verbose
 
   -v: verbose
  
See also:
+
Source code in ~krypton/lml/facil 
krypton/Huang/README, components.pl, Kth_pt.m, num_observed.m, mean_minimum_distance.m,objs2mst.pl
+
  -d dimage.i2i : save the distance image as dimage.i2i (converted to ints by casting)
 +
  -n: don't normalize the histogram by the number of voxels in the mask at that distance
 +
  -a #:  average together this many time pts for output histogram. default = 20
 +
see also: histogramL, histogram2
  
Source code in ~krypton/lml/facil 
+
Copyright 2010 University of Massachusetts Medical School and the Biomedical Imaging Group
 +
All rights reserved. Explicit permission to use this program must be received prior to use.
 
   
 
   
== Image Manipulation ==
+
</nowiki>
===  align_quadrants.pl  -h ===
+
===  analyze_histo ===
This program displays the four quadrant images of a well.  The user then saves 3 pairs of points
+
  <nowiki>
(s when middle mouse is pressed). Each pair of points should be points that match in two
+
# /home/lml/krypton/bin/analyze_histo
neighboring quadrants.  When done, each quadrant must have one (or two) points specified.
 
Points must be in pair order (see recalc_quadrant2.pl).  When done, the use must write them out
 
via z (when middle mouse is also pressed, no confimation is given in play).  
 
The quadrant images are then aligned based on these points and newimage.i2i is created.
 
  
It will also create a file with the output from play, for future reference.
+
Analyzes the output histogram image produced by histogram2 via the -f option.
It will be named, eg, G02_combined_play.pts. It can be passed manually to recalc_quadrant2.pl to redo
+
Prints out 2 columns: first column is bin number, second column is value at the cutoff.
the alignment if necessary.
+
This is similar to the program "threshold" but instead of one threshold value for the
 +
entire image, it gives one at each distance (from a membrane).
  
usage:
+
Usage: analyze_histo [options] aimage_H.i2i  
  align_quadrants.pl [options] well newimage.i2i
+
options:
 +
-v: calculate cutoff based on percentage of voxels instead of percentage of light
 +
-f #: fractional cutoff (e.g., .80 = 80%), default = 0.950000
 +
-w #: number of bins for running average (default = 5), should be odd.
 +
-t #: only look at voxels >= intensity (must be >= 0), default = 1
  
 +
Examples:
 +
histogram2 -f a_H.i2i -O a_H.histo -o -p 0 0 0 -d 40 -z 3 mask.i2i a.i2i b.i2i
 +
analyze_histo -f .95 a_H.i2i > a_H.cutoffs
  
examples:
+
See also: histogram, histogram2, threshold
  align_quadrants.pl [options] G02 G02_combined.i2i
 
  
options:
+
source code in /storage/big1/lml/jac/was_invitro/Projects/boundary/boundary
-no_pts_output don't produce the pts file
+
-noblend by default the quadrant images are blended together where
+
</nowiki>
they overlap. use this option to turn that off.
+
=== analyze_yaodl  ===
-print_overlap also print the amount of overlap to stderr
+
<nowiki>
-debug
 
-debug_all
 
  
 +
This program reads in a yaodl file as produced by DAVE (volume widget menu: volume to surface ...)
 +
(hmc produces an ascii format which analyze_yaodl can't handle).
 +
It identifies connected surfaces (since DAVE considers all surfaces from one pass as one object).
 +
It then calculates and prints the volume and surface area of each connected surface.  Optionally
 +
it will write out a yaodl files (-y) for the largest surface found for each object, with better normals.
 +
This surface can be read back into DAVE with -y option.
  
see also:
+
Usage: analyze_yaodl [options] infile.ydl
combine_images
+
options:
recalc_quadrant2.pl
+
  -y largest.ydl:  write out largest surface of eac object to largest.ydl
/home/lml/krypton/Corvera/Raz/README 5/16/14
+
  -i image.i2i:   read in the image file associated with infile.ydl (not needed for anything yet).
http://wiki.imagej.net/Grid/Collection_Stitching_Plugin
+
        -n: recalculate "better" normals (use this with the -y option)
 
+
(dave used to produce terrible normals, now they are ok, so this isn't needed anymore)
 +
  -v: verbose
  
 +
note: source code in /storage/big1/lml/Fischer/src directory.
 
   
 
   
===  combine_images.pl  -h ===
+
</nowiki>
 +
===  BestPath ===
 +
<nowiki>
  
This program runs combine_images on all the images in the current directory.  All images which have names
+
Finds the brightest path from a start pixel to a stop pixel (1-indexed).
like L##_morestuff.i2i (where L is any letter and # is any digit) will be combined;
 
all the A02 will be combined (to produce A02_comb.i2i), all the A03, etc.
 
The resulting image for the combination of the A02 images will be A02_tag.i2i (see -newtag option, e.g. A02_comb.i2i).
 
Any images already existing in the current directory with a name like L##_stuff_oldtag.i2i will be ignored. 
 
  
usage:
+
Usage:
combine_images.pl [options]
+
BestPath [options] image.i2i
 +
Options:
 +
-t #: threshold. Only pixels with values > # are allowed in the path, default = 0.000000
 +
-s x y z: start coordinate (1-indexed). default = (1,1,1)
 +
-S x y z: stop coordinate (1-indexed). default = (1,1,1)
 +
-v: verbose
  
options:
+
Source code in ~krypton/lml/facil 
-newtag=something The output filename for L##*.i2i will be L##_newtag.i2i. Default = comb
+
-oldtag=something Any files of the form L##*_oldtag.i2i will be ignored. Default = comb
+
</nowiki>
-pixsize=# pass this as -p # to combine_images program (pixel size).  
+
===  BestPath3D  ===
Specify -pixsize=2.41 (um/pixel) for the 2.5X objective.
+
<nowiki>
-reduceima=#:#:tag After creating output image, apply reduceima to it
+
 
with -bin # # and the specified output tag on the name.
+
Finds the brightest path from a start pixel to a stop pixel (1-indexed).
So, e.g., A02_comb.i2i will become A02_tag.i2i
+
Converts voxels into nodes in a graph and finds the lowest cost path from the start node to the stop node.
-flipx flip images in X prior to combining them
+
The cost of each node is (maxval-imval), so bright nodes have less cost. Output in rpts format to stdout.
-flipy flip images in Y prior to combining them (can be used at the same time as -flipx)
+
BestPath3D always turns all (above threshold) voxels in the image into graph nodes. BestPath3D_ellipse only
-x=#:#:#:# manually specified picture offsets. see combine images
+
looks at voxels within an ellipse with a major axis connecting the start and endpts.
-y=#:#:#:# manually specified picture offsets. see combine images
+
Usage:
-o=# number of pixels the images overlap (ignores info in image headers). see combine_images
+
BestPath3D [options] image.i2i > image.rpts
-f do MOT pad images at border (as of 2/3/14). see combine_images.
+
BestPath3D_ellipse [options] image.i2i > image.rpts
-remove Remove the full-size combined image (e.g., A02_comb.i2i) when done (use with -reduceima).
+
Options:
-dummy Just echo what would be done, but don't do anything
+
-t #: threshold. Only pixels with values > # are allowed in the path, default = 0.000000
-verbose Echo as things are done.
+
-s x y z: start coordinate (1-indexed).
-debug
+
-S x y z: stop coordinate (1-indexed).  
 +
Up to 1000  pairs of start/stop pixels can be specified. At least one pair must be specified.
 +
-r scale black  rescale image values so new = (old-black)/scale prior to being used
 +
-n name name of object that is placed into the rpts file.
 +
-f exfac perpfac: Only used if you are running BestPath3D_ellipse
 +
        sets principal axis a to have the specified endpts (from -s and -S), then expands it by factor exfac,
 +
                        and sets the length of the perpendicular b and c axes to be perpfac times the original axis a length
 +
defaults: exfac = 1.000000, perpfac = 1.000000
 +
-v: verbose
 +
-d: debug
 +
-D debug.i2i: debug. also write out image with 50 added to all voxels within the ellipsoid.
 +
 
 +
Examples:
 +
make_spiralim -d 200 200 30 -r 70 -p spiral_small.i2i  # create a test image
 +
                -s 171 101 1  -S 170 99 30            # written out by make_spiralim
 +
BestPath3D_ellipse -v -t -1 -s 171 101 1 -S 170 99 30 -f 3 13 spiral_small.i2i > spiral.rpts
 +
note: spiral_small.i2i is a tough case, since the spiral goes very far from the start/stop points
 +
This requires a -f 3 to expand out the endpts and then a 13 to expand out perpendicularly.
 +
If you just expand out perpendicularly (e.g. -f 1 13) the ellipsoid doesn't grow faster enough
 +
near the endpts so some of the spiral data is not included in the ellipsoid. See -D option.
  
note:
+
See also: make_spiralim, BestPath, BestPath2, make_ellipsoid, DAVE -> Stuff -> Best Path ...
combine_images (in /storage/big1/lml/Linux/bin) and reduceima (in /storage/big1/kef/Linuxbin) must be in your
 
path for this perl script to work. You can check this by just typing: which combine_images  and  which reduceima;
 
if they are not found you need to add their directory to your PATH environment variable (echo $PATH will show you
 
what it is currently). How this is done varies depending upon which shell you are running. Under tcsh it would
 
be  setenv PATH $PATH:/storage/big1/kef/Linuxbin:/storage/big1/lml/Linux/bin .
 
  
example:
+
Source code in ~krypton/lml/facil 
      cd /storage/big3/kdb/Zeiss/20130326/GEDMAT_002_PRO_SQ2_DAY14
+
# Combine all images in each well. The combined image will be L##_combined (-newtag=combined).
+
</nowiki>
# Then reduce the combined size back down to the size of one original image;
+
===  BestPath3D_ellipse  ===
# call the new image L##_combined_reduc.i2i (-reduceima=2:2:reduc).   
+
<nowiki>
# Finally, remove the big (unreduced) combined image (-remove).   
+
 
# First do a dummy run (-dummy) to see if it is going to do what we want:
+
Finds the brightest path from a start pixel to a stop pixel (1-indexed).
      combine_images.pl -newtag=combined -reduceima=2:2:reduc -pixsize=2.41 -remove -dummy   
+
Converts voxels into nodes in a graph and finds the lowest cost path from the start node to the stop node.
# ok, now the real thing (just leave off -dummy):
+
The cost of each node is (maxval-imval), so bright nodes have less cost. Output in rpts format to stdout.
      combine_images.pl -newtag=combined -reduceima=2:2:reduc -pixsize=2.41 -remove
+
BestPath3D always turns all (above threshold) voxels in the image into graph nodes. BestPath3D_ellipse only
 +
looks at voxels within an ellipse with a major axis connecting the start and endpts.
 +
Usage:
 +
BestPath3D [options] image.i2i > image.rpts
 +
BestPath3D_ellipse [options] image.i2i > image.rpts
 +
Options:
 +
-t #: threshold. Only pixels with values > # are allowed in the path, default = 0.000000
 +
-s x y z: start coordinate (1-indexed).
 +
-S x y z: stop coordinate (1-indexed).  
 +
Up to 1000 pairs of start/stop pixels can be specified. At least one pair must be specified.
 +
-r scale black  rescale image values so new = (old-black)/scale prior to being used
 +
-n name name of object that is placed into the rpts file.
 +
-f exfac perpfac: Only used if you are running BestPath3D_ellipse
 +
        sets principal axis a to have the specified endpts (from -s and -S), then expands it by factor exfac,
 +
                        and sets the length of the perpendicular b and c axes to be perpfac times the original axis a length
 +
defaults: exfac = 1.000000, perpfac = 1.000000
 +
-v: verbose
 +
-d: debug
 +
-D debug.i2i: debug. also write out image with 50 added to all voxels within the ellipsoid.
 +
 
 +
Examples:
 +
make_spiralim -d 200 200 30 -r 70 -p spiral_small.i2i  # create a test image
 +
                -s 171 101 1  -S 170 99 30            # written out by make_spiralim
 +
BestPath3D_ellipse -v -t -1 -s 171 101 1 -S 170 99 30 -f 3 13 spiral_small.i2i > spiral.rpts
 +
note: spiral_small.i2i is a tough case, since the spiral goes very far from the start/stop points
 +
This requires a -f 3 to expand out the endpts and then a 13 to expand out perpendicularly.
 +
If you just expand out perpendicularly (e.g. -f 1 13) the ellipsoid doesn't grow faster enough
 +
near the endpts so some of the spiral data is not included in the ellipsoid. See -D option.
  
see also:
+
See also: make_spiralim, BestPath, BestPath2, make_ellipsoid, DAVE -> Stuff -> Best Path ...
combine_images
 
/storage/big1/raz/GEDMAT
 
mask_gedmat_images.pl
 
  
 +
Source code in ~krypton/lml/facil 
 
   
 
   
===  overlap_images.pl  -h ===
+
</nowiki>
 +
===  boundaryL ===
 +
<nowiki>
 +
Usage:
 +
  boundary [options] original.i2i
  
  Takes output from parsepos.pl and calculates how the images overlap so they can then be combined easily (-create option).
+
Description:
 +
  Boundary takes an image, applys a threshold to the image,
 +
  rolls a ball outside then inside the object. This defines
 +
  what pixels are considered inside, outside, and boundary.
 +
 
 +
  Expects:  Input image and optionally some given options
 +
  Modifies: Nothing
 +
  Returns: Output image with the name of image with _B added.
 +
            (if input.i2i was original image input_B.i2i
 +
            is output image)
 +
 
 +
Options:
 +
-I        : Do not roll ball inside of the cell.
 +
              (rolling the ball inside the cell results
 +
              in a smoother surface)
 +
  -r #      : Set radius to # for sphere exterior to cell.
 +
              (default = 3)
 +
-R #      : Set radius to # for sphere interior to cell.
 +
              (default = 3)
 +
-t #      : Set threshold for all z slices to > #.
 +
              (default is 10)
 +
-T filename: Use file filename for thresholds for each z slice.
 +
              (one threshold for each zslice - one threshold on a line)
 +
-X        : Restrict search in X direction.
 +
              (can be used to cap a cylinder whose long axis
 +
              is along the x axis)
 +
-Y        : Restrict search in Y direction.
 +
              (can be used to cap a cylinder whose long axis
 +
              is along the y axis)
 +
-i string  : Add string to history of output image.
 +
-h        : Print this message.
 +
-H        : Print this message and then some.
  
overlap_images.pl [options]
+
Caveats:
 +
  Requires lots of memory and time to run (megabytes+minutes).
  
options:
+
Notes:  
-xdim=# xdim of image in pixels, default = 1392
+
  Entire image name (with extension) is required.
-ydim=# ydim of image in pixels, default = 1040
+
  Pixel values: boundary = 2, outside = 4, inside = 6.
-zdim=# zdim of image in pixels, default = 25
+
  Output image is padded on all sides by 2*radius+1 of
-pixsize=# size of pixels in um, default = 0.645
+
  sphere rolled on the outside of the object.
-create=file.i2i actually combine the images into one big image
 
-flipx flip each image around its x-axis prior to inserting it into the new image (if -create is specified)
 
-flipy flip each image around its y-axis prior to inserting it into the new image (if -create is specified)
 
-verbose
 
-dummy just echo what would be done, but don't do anything (nothing normally done anyway unless -create specified).
 
  
see also:
+
Keywords:
parsepos.pl
+
  surface location, boundary, boundaries, border
insert_image called by this program if -create is specified.
+
 
reduceima if -create is used, this may be needed to make the image small enough to see via play.
+
Additional programs:
+
  histogram, shrink_wrap, createBoundary, analysis
example:
 
        parsepos.pl -pre=/storage/big3/kdb/Zeiss/20121004/LectinExp3/ -post=_1_1_20121004_LectinExp3.i2i  \
 
                /storage/big3/kdb/Zeiss/20121004/LectinExp3/LextinExp3.pos | overlap_images.pl -create=newimage.i2i
 
reduceima -A -bin 4 4 newimage.i2i newimage_reduced.i2i
 
  
note: you may need /storage/big1/lml/Linux/bin and /storage/big1/kef/Linux/bin in your path
+
Last Changed: Wed Feb 10, 1993
  
source code in /storage/big1/lml/Corvera/Olga/data/ptrs
 
see also: insert_image
 
  http://bigwww.epfl.ch/algorithms.html -> MosaicJ (which may already exist in Fiji)
 
  
+
</nowiki>
===  parsepos.pl  -h ===
+
===  calc_area ===
  Parse a position file produced by Zeiss system to pull out x y coords for each of the images taken in well C09.
+
  <nowiki>
Output triples (well_id x y) written to stdout.
 
Position may be in microns, x increasing to the right, y increasing down.
 
  
parsepos.pl filename.pos
+
This program takes in a surface image and a data image and calculates:
 +
1). the area of the surface (number of nonzero voxels)
 +
2). the number of data voxels (nonzero voxels in image2)
 +
3). the number of surface voxels (area) within a specified distance of a data voxel.
 +
This information is printed to stderr.
  
  options:
+
Typically one might apply a shrink_wrap to, say, a Vinculin image of a dual
-well=string well to analyze. default = C09
+
labelled image pair. Then make_surface would convert this to a surface.  
-pre=prestring add this string in front of the well_id
+
After this, map_to_surface would be applied to the 2 dual labelled images.
-post=postring add this string after the well_id
+
Then overlap would be used to calculate the overlap of the two data sets
these two options are needed if you want to pass this output to
+
(given some overlap range, which defaults to 1).
overlap_image.pl -create=newimage.i2i, since that will need to be able
+
Then this program (calc_area) is used to get the area of the surface and the
to find the image associated with each well_id.
+
amount of it which is examined using the range specified to the overlap program.
-verbose additional output to stderr
+
This is important since to calculate the probability that the overlap was
-vverbose additional output to stderr
+
due to chance you want to know what percentage of the area was included in
 +
the overlap calculation.
  
example:
+
Usage: calc_area [options] surface.i2i data.i2i
parsepos.pl -pre=/storage/big3/kdb/Zeiss/20121004/LectinExp3/ -post=_1_1_20121004_LectinExp3.i2i  \
+
options:
/storage/big3/kdb/Zeiss/20121004/LectinExp3/LextinExp3.pos | overlap_images.pl -create=newimage.i2i
+
  -r range: range in voxels (default = 1).
+
  -i image.i2i: also produce an output image
 +
  this image will have bit 2 set for original data voxels
 +
  and bit 1 set for surface voxels near (or on) data voxels
 +
  (so it would be a voxel with a value of 1 or 3).
  
 +
note: entire image name (with extension) is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
note: a compressed image will be automatically be uncompressed.
  
  see also:
+
Source code in /storage/big1/lml/was_invitro/Moore/pkc
overlap_images.pl
+
insert_image
+
</nowiki>
 +
=== closest_object  ===
 +
<nowiki>
 +
 
 +
Calculates the closest distance from an object in image1 to an object in image2.  Also calculates closest distance
 +
between objects within each image separately.  Prints out info about matches.  If no other object is within the
 +
maximum distance (see -m option), the object is printed matching to object -1 at a huge distance.
 +
Histogram of these distances is printed to stdout.
 +
The input images should have each pixel in an object having the object id as its value. These images can be
 +
produced with "countobjs -Q" or "objs_via_ascent" 
  
  note: you may need /storage/big1/lml/Linux/bin and /storage/big1/kef/Linux/bin in your path.
+
Usage:
 +
closest_object [options] image1.i2i image2.i2i > im1_im2.hist
 +
Options:
 +
-t # #: image1 and image2 thresholds, pixels > # are above threshold, default = 0.
 +
-w # # #: x,y, zweights for pixel distances (ie, pixel size), default = 1 for each.
 +
-m # :         maxdistance (in units used for -w) to look for the closest pixel, default = 10.000000
 +
-r #:         resolution for output histogram, ie, binsize, default = 0.100000
 +
-e lowx lowy lowz hix hiy hiz:  only look at voxels within this extent (subvolume), 1-indexed, inclusive.
 +
-s minsize maxsize:    only look at objects in image1.i2i within the size range (inclusive, in voxels)
 +
-S minsize maxsize:    only look at objects in image2.i2i within the size range (inclusive, in voxels)
 +
-i miniod maxiod:    only look at objects in image1.i2i within the iod range (inclusive)
 +
-I miniod maxiod:    only look at objects in image2.i2i within the iod range (inclusive)
 +
-d image1d.i2i: the original intensity image for image1 (since image1 has pixel values as id numbers)
 +
-D image2d.i2i: the original intensity image for image2 (since image2 has pixel values as id numbers)
 +
if you want the iod or pixel intensity stats to be meaningful, you need to provide
 +
the original data by using the -d and -D options.
 +
  -v: verbose
 +
  -V: very verbose
 +
Examples:
 +
    Find the distance from the closest Ryr voxel in each object to a BK object. Record the iod
 +
    of the BK object in the histogram:
 +
countobjs -t 5 10 -Q ryr_id.i2i ryr.countobjs ryr.i2i      : this finds Ryr connected objects and labels them with id
 +
countobjs -t 10 10 -O bk_iodR.i2i bk.countobjs bk.i2i     : this calculates the iod of BK objects
 +
float2intL -M 30000 bk_iodR.i2i bk_iod.i2i     : rescale BK iod to integer format
 +
closest_object -w 1 1 3 -o 5 100 ryr_id.i2i bk_iod.i2i > ryr_bk.info
 +
cull -s -c -1 -4 < ryr_bk.info |xmgrace -source stdin
 +
        note: you may want to take a 10 pt running avg inside xmgrace to compensate for
 +
issues related to discretization of distances
 +
See also:
 +
closest_voxel objs_via_ascent /home/lml/krypton/Zhuge/BKandRyr/graph.pl,match.pl
 +
Bugs:
  
 +
Source code in ~krypton/lml/facil 
 
   
 
   
===  prep_and_restore.pl  -h ===
+
</nowiki>
 +
===  closest_voxel ===
 +
<nowiki>
  
Restores all the i2i files in the current directory. Skips any files with  _.i2i or _r.i2i in their name.
+
Calculates the closest distance from an above threshold voxel in image1 to an above threshold voxel in image2.
Also ignores any files which do not have dat or ctx in their name.
+
Histogram of these distances is printed to stdout.
  
options:
+
Usage:
-dummy just print what would be done
+
closest_voxel [options] image1.i2i image2.i2i > im1_im2.hist
-bkgnd=# pass this through to find_bkgnd as the -a option. eg, -bkgnd=-.10 will lower the bkgnd value
+
Options:
which is subtracted off by 10 percent.
+
-t # #: image1 and image2 thresholds, pixels > # are above threshold, default = 0.
        -smooth=#       smoothness factor (smaller is less smoothing). default = .00002
+
-w # # #: x,y, zweights for pixel distances (ie, pixel size), default = 1 for each.
        -iterations=#   maximum number of iterations, default = 999
+
-m # :         maxdistance (in units used for -w) to look for the closest pixel, default = 10.000000
        -scale=#:#      GFP and RFP output scaling for restoration (respectively). default = 1.0 and 1.0.
+
-r #:         resolution for output histogram, ie, binsize, default = 0.100000
-verbose echo what is being done
+
-s lowx lowy lowz hix hiy hiz:  only look at voxels within this subvolume, 1-indexed, inclusive.
        -maxfiles=# only analyze this many files. primarily for debugging
+
-Q: only the voxel in each image1 object closest to an image2 voxel should count.
-twod during background subtraction, vary the background value for each 2D slice, instead of
+
Use this if image1.i2i was created via the -Q option from countobjs.
just using the same value for all z slices.
+
-o minsize maxsize:    only look at objects in image1.i2i within the size range (inclusive, in voxels)
-files=:file.i2i:...:filen.i2i  just restore these files. and do it even if _.i2i or _r.i2i exists.
+
must use -Q option along with this.
-dont_restore  do the data prep (filename_.i2i and filename__.i2i produced), but don't do the restoration (but not filename__r.i2i).
+
-p: also print the detailed info of which voxel matched to which other voxel
-beowulf queue the restorations to run on our beowulf (dispatched via qsub, using pbs (torque), from a daemon running on m13)
+
  -v: verbose
rather than immediately on the localhost.  
+
  -V: very verbose
see also: pbsnodes (on m13, only servers running fc16 or fc17 are on the allowed list right now)
+
Examples:
          qstat -f (on m13) will show lots of info on each job.
+
    Find the distance from the closest Ryr voxel in each object to a BK object. Record the iod
If this is not specified, each restoration is run sequentially, with this script blocking while waiting for each one.
+
    of the BK object in the histogram:
-gpu only use this if you are logged into zirconium. It will run the restoration on zirconium using the GPU version
+
countobjs -t 5 10 -Q ryr_id.i2i ryr.countobjs ryr.i2i      : this finds Ryr connected objects and labels them with id
of the restoration.
+
countobjs -t 10 10 -O bk_iodR.i2i bk.countobjs bk.i2i     : this calculates the iod of BK objects
-outdir=dir    rather than place the results in the current directory, place it in the fully qualified specified directory.
+
float2intL -M 30000 bk_iodR.i2i bk_iod.i2i     : rescale BK iod to integer format
leave off the last /
+
closest_voxel -w 1 1 3 -o 5 100 -Q ryr_id.i2i bk_iod.i2i > ryr_bk.info
      -GFPpsf=file    fully qualified path to GPFpsf (used when file name is *_#_#_1*.i2i, eg,  file_0_1_1.i2i)
+
cull -s -c -1 -4 < ryr_bk.info |xmgrace -source stdin
default = /storage/big1/lml/Corvera/Olga/data/GFPpsf_segxyz_.i2i
+
        note: you may want to take a 10 pt running avg inside xmgrace to compensate for
note: psf should have background values of ~0, otherwise 0-padding will produce blocking artifacts.
+
issues related to discretization of distances
      -RFPpsf=file    fully qualified path to RPFpsf (used when file name is *_#_#_2*.i2i, eg,  file_0_1_2.i2i)
+
See also:
default = /storage/big1/lml/Corvera/Olga/data/RFPpsf_segxyz_.i2i
+
graph.pl
note: psf should have background values of ~0, otherwise 0-padding will produce blocking artifacts.
+
Bugs:
-silent print less info
+
 
 +
Source code in ~krypton/lml/facil 
 +
 +
</nowiki>
 +
===  coloc  ===
 +
<nowiki>
  
 +
This program reads in 2 or 3 images, and writes out an image in which
 +
colocalized voxels (voxels > threshold in all images) are kept, others
 +
set to 0.  By default colocalized voxels are set to image1 values.
 +
Usage: coloc [options] image1 image2 [image3] outimage
 +
options:
 +
-a #:        threshold for image 1 (default = 0)
 +
-b #:        threshold for image 2 (default = 0)
 +
-c #:        threshold for image 3 (default = 0)
 +
-va:          make outimage pixel value be value of image 1
 +
-vb:          make outimage pixel value be value of image 2
 +
-vc:          make outimage pixel value be value of image 3
 +
-vu #:        make outimage pixel value be user specified, #
 +
note: source code in /storage/big1/lml/Laxman/src/coloc.c
  
  examples:
+
</nowiki>
cd /storage/big3/kdb/Zeiss/20121004/LectinExp3
+
===  coloc3ims  ===
        /home/lml/krypton/Corvera/Olga/prep_and_restore.pl -files=G11_0_1_1_20121004_LectinExp3.i2i:G03_0_1_2_20121004_LectinExp3.i2i
+
<nowiki>
      -beowulf -outdir=/storage/big1/lml/Corvera/Olga/data
 
  
  see also:
 
epr_beowulf    a GUI front end for submitting individual restoration jobs to the beowulf queue
 
/storage/big1/epr/bin/cuda/epr_gpu -cuda 1  if logged into zirconium, will run a single job on the graphics card (like -gpu option).
 
prepdata
 
preppsf
 
  
  note: /storage/big1/lml/Linux/bin /storage/big1/lml/Linux/bin64 and /storage/big1/kef/Linux/bin probably need to be in your
+
This programs reads in three images and produces a new version of image3.
path to successfully run this script.
+
Each voxel which is colocalized (has image1 > thresh1
 +
and image2 > thresh2) has the value in image3 set to 32000 (-n 32000). Otherwise the value in image3 is not
 +
changed.  Once these modifications are made, image1.i2i image2.i2i and newimage3.i2i can be read
 +
into DAVE (in that order) and voxels which are colocalized in the first two channels
 +
will be guaranteed to be colocalized in the third channel.
 +
 
 +
Usage: coloc3ims [options] image1.i2i image2.i2i image3.i2i newimage3.i2i
 +
options:
 +
  -t thresh1 thresh2:  thresholds for image1 and image2, defaults = 0 and 0
 +
  -n newval: instead of setting newimage3 to 0, set it to newval
 +
  -m: instead of setting newimage3 to 0, set it to the max value in image3.i2i
  
 +
note: entire image name (with extension) is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
note: a compressed image will be automatically be uncompressed.
 
   
 
   
===  prepfiles.pl  -h ===
+
</nowiki>
prepfiles.pl [options] 
+
===  coloc_tseries2 ===
 +
<nowiki>
 +
 
 +
Similar to coloc_tseries, but compares a 2D time series to itself.
 +
Prints xmgr formatted graphs to stdout.
  
Takes a dual-wavelength image and splits it into two separate images (segim_huge), applies scratchng, and prepdata.
+
Usage: coloc_tseries2  image1 outfile
Run this from a directory. It will be applied to all images in the directory. There must be
+
options:
a file called dark.i2i in the directory too. Removes all intermediate files and original 2wavelength image.
+
-t thresh:    only count voxels > thresh. default = 0
 +
-z start stop: only look at these z planes (inclusive, 1-indexed). default = all z planes.
 +
-n: don't include a legend in the stdout.
 +
        -v:          verbose
  
options:
+
source code in: /home/lml/krypton/facil
  -safe : don't delete the original dual-wavelength image
 
  -echo : echo what is being done
 
  
 +
see also: /home/lml/krypton/Corvera/paper2010/Dynamics_in_Dave/README
 
   
 
   
===  recalc_quadrant2.pl  -h ===
+
</nowiki>
align_quadrants.pl calls this program. It is easier to use it than to call recalc_quadrant2.pl manually.
+
===  com_2d_objs ===
 +
<nowiki>
 +
 
 +
This program takes an image and finds the intensity weighted center of mass of each 2d object.
 +
Object 1 is all pixels with value = 1, object 2 is pixels with value 2, etc. Max objects = 10
 +
Statistics are written to stdout
  
This program converts from pts printed by play (so in the coordinate system gotten from combining the four quadrant images of a well (with no overlap))
+
Usage: com_2d_objs [options] image.i2i
to one used by register_images.pl (ie, each pt is in the coordinate system of its own individual image).
+
options:
It also pairs the points up and orders them the way that register_images.pl requires.
+
  -z start stop: zplanes to analyze. 0-indexed inclusive. default is all z planes
It assumes the user picked matching pairs of pts in order when using play.  Eg, first a pt was picked (s key while holding down middle mouse button),
+
  -r #: put data out rpts format (integer coords, only center of mass info). Only use if only one object.
then its matching point in a neighboring quadrant was picked.  This was then repeated 3 times (so 3 pairs of points are present).
+
# is the pixel value (!= 0), usually -1 through -7.
note: the file names for the files associated with each quadrant are not stored in the output by default, just the quadrant number,
+
  -o: coords should be one-indexed (ie, min x = 1). default = 0. -r sets this automatically.
      use -qnames to change this; they are needed if you want to subsequently have register_images.pl use chained.txt to actually combine the images.
+
  -v: verbose
  
 +
Source in /home/lml/krypton/facil
 +
See Also: /home/lml/krypton/Lawson/Jacques/README
  
recalc_quadrant2.pl [options] < pts.txt > chained.txt
+
Examples:
 +
  planimeter3.20081007 -I 110215ligand_0_491.i2i -R 110215ligand_0_491_cell1.rpts
 +
  interp -S -p -1 -o cell1 110215ligand_0_491_cell1.rpts 110215ligand_0_491_cell1_interpS.rpts
 +
  create_dcimL -d 1 -s 502 501 1440 one.i2i
 +
  addlines one.i2i 110215ligand_0_491_cell1_interpS.rpts - | maskedsmul -O 0 one.i2i - cell1_binary.i2i
 +
    # could do the same for a second object (etc), with create_dcimL -d 2, then use mathi2i
 +
    # to add the images before analysis
 +
  com_2d_objs cell1_binary.i2i > cell1_binary.stats
 +
 +
</nowiki>
 +
===  exo4  ===
 +
<nowiki>
 +
Phase 1: Associates each voxel in inimage.i2i which is > threshold with a maxima in the image.  It finds
 +
        the maxima by doing a steepest ascent walk in the image.  Writes summary info about regions found to
 +
        stdout in the same format as countobjs.  Only the location of the maxima found in phase 1 are passed to phase 2.
 +
        All vesicles must start out as maxima. (see also -readmax option)
 +
Phase 2: In each rolling window of time points (see -w), examines the intensity over time of each maxima
 +
        (found in previous step) to see if it
 +
        meets certain criteria (i.e., looks like a vesicle fusing with the plasma membrane - undergoing
 +
        exocytosis).  If it matches this criteria it prints out the "path" of the maxima and its
 +
        pixel value and iod value.  These paths can be converted to rpts format for
 +
        addlines or xmgr format
 +
        using found4.pl. 
 +
The fusion model: think of intensity as shown below. once the vesicle primes its intensity jumps. when it fuses
 +
it drops back down.
  
options:
+
peak intensity profile:
-res=# resolution the display was downsampled by prior to getting coords (ie, what was used in chres, see below).
+
  pintens                  ----------------
if chres was .5, then -res=2, ie, 1/chres value. default = 2.
+
                          |                |
-xdim=# default = 1392
+
                        |                  |
-ydim=# default = 1040
+
                        |                    |
-qnames=name0:name1:name2:name3    file names associated with the images used to produce each of the 4 quadrants.
+
  tintens -------------                      ------------------
  they must be in this order. If not specified, then the output will not be
+
 
  usable by register_images.pl (unless -root is implemented there).
+
          0  t1      t2                  t3
-outimage=image.i2i also produce an output combined image (ie, call register_images.pl, see below).
+
          0  t1      |prise|              |ffall|
-qnames required for this option.
 
-blend if -outimage is specified, then blend the overlapping images to produce the output image.
 
-verbose print overlap info to stderr. maybe to use in -o option to combine_images.
 
-debug stuff to stderr
 
  
more info. the quadrants in the combined image (see combine_images below) are numbered as follows:
+
t1: time of tethering (should stop moving)
quadrant 1 |  quadrant 3
+
t2: time of priming (peak intensity increases from tintens to pintens)
quadrant 0  |  quadrant 2
+
t3: time of fusing (peak intensity drops back down, but iod should stay high and possibly even increase a bit)
    where x increases to the right, y increases up
+
prise is the time it takes to rise froom tintens to pintens during priming (docking)
 +
ffall is the time it takes to fall from pintens to tintens during fusion.
 +
 +
exo4 is similar to exo3 but has slightly different options and checks all possible fusion times
 +
simultaneously. exo3 only picked the latest (in time) possible fusion event based only upon intensity
 +
changes during the falltime. exo4 considers what is happening elsewhen in the window before deciding
 +
on a fusion time. It picks the fusion candidate (iod rise and intensity fall) which is closest in time to
 +
  the maxima disappearing (-check_max) and which has a stationary period (-primedtime) within the
 +
specified time range. Hopefully this makes it less likely to make mistakes.
  
example:
+
Should work in 2d or 3d.  Only reads in a window of time points at once
 +
so should be able to handle large images.
  
# combine the 4 well images without overlap to see what pts might match between quadrants:
+
Usage:
    combine_images -o 0 F06_0_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i F06_1_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i 
+
  exo4 [options] inimage.i2i > inimage.count
          F06_2_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i F06_3_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i tmp.i2i
 
  
# look at the resulting image and identify matching pts:
+
Options:
    chres -S .5 .5 1 tmp.i2i - |play -    # save (s) pairs of pts which match between the quadrants. print them using z.  create file F06_pts.txt:
 
marked points
 
x= 769 y= 497 z=  1 set=  1 value=    3099
 
x= 799 y= 525 z=  1 set=  1 value=    3684
 
x= 709 y= 819 z=  1 set=  1 value=    4039
 
x= 682 y= 854 z=  1 set=  1 value=    3974
 
x= 518 y= 497 z=  1 set=  1 value=    3257
 
x= 543 y= 524 z=  1 set=  1 value=    3436
 
  
# now use this program to multiply by 2, subtract xdim (1392) and/or ydim (1040) as appropriate, pair and order pts.
+
options related to input:
    recalc_quadrant2.pl -outimage=F06_combined.i2i -qnames=F06_0_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i:F06_1_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i:F06_2_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i:F06_3_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i < F06_pts.txt > F06_chained.txt
+
  -T startt stopt : only examine these time points (0-indexed, inclusive)
 +
  -p numskip numuse : patterned read.  skip numskip z planes, then analyze numuse zplanes, then repeat.
 +
  This is useful if the acquisition protocol was, e.g., 1 fps for 1 min, 20 fps for 3 seconds
 +
  repeated over and over, and you only want to look at the 20 fps data.  
 +
  numuse must be >= window size (see -w option). Pattern starts at t=0 even if -T is
 +
  specified (but startt time points are still skipped).
 +
  -w #         : number of time pts in a window, default = 100
 +
                        a negative number means read in entire dataset at once (one big window)
 +
  -jump # : jump # time pts before examining next window of time pts. This doesn't skip data, just
 +
  analyzes a "window" less often (so more has changed). Default = 0
 +
                        which means the very next time pt is added to window (and oldest dropped) and then
 +
                        the window of data is re-evaluated. May not work with -p option.
 +
  -r rptsfile : read in rptsfileshould have one closed object in it. Uses this as a mask for all the planes.
 +
  -d tdim : the time dimension of the image (over-rides anything stored in the header)
 +
  -b #: : blur (smooth) image before looking for objects (maxima), using a window of the specified
 +
: halfwidth (in pixels) in x,y, and z (z width will be set to 0 if 2*width > zdim).
  
# same thing, but in two steps.
+
Phase 1: options related object finding via ascent (see objs_via_ascent2d), info printed out.
    recalc_quadrant2.pl -qnames=F06_0_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i:F06_1_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i:F06_2_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i:F06_3_2_0_20140505_GEDMAT_P025_WES_OM_Day14.i2i < F06_pts.txt > F06_chained.txt
+
          If an object doesn't satisfy these criteria, its maxima is not kept, so it is not considered a maxima
    register_images.pl -zdim=5 -xscale=1 -yscale=1 -post= -debug -out=F06_combined.i2i F06_chained.txt
+
          for the next stage of processing which tracks maxima into paths and checks if they are fusion events.
 +
          The iod and size specified here are also used later, but the next phase just looks with the square iod region.
 +
  -t threshold : any voxel > threshold in inimage.i2i is tracked to a 3d maxima (default = 0.0).
 +
  -i miniod maxiod : erase all objects whose iod doesn't fall in the specified range (default: 1-1000000000)
 +
  -s minsize maxsize : erase all objects whose size (in voxels, inclusive) doesn't fall in the specified range
 +
  (default = 1-1000000). note: object size and iod might be large since all voxels which
 +
  connect up via steepest ascent algorithm to the maximum count in this first phase.
 +
  -strict_max : ignore "maxima" which are really on a plateau (option might cause
 +
                        saturated maxima to be missed)
 +
  -readmax file : skip phase 1, instead just reading maxima in from the specified file
 +
 
 +
Phase 1b: noptions related to fitting Gaussians (not used for anything yet):
 +
  -g # : fit Gaussians (+ dc term) to each object found (eventually I will use this for something).
 +
  only includes pixels in object within # pixels from the brightest point.
 +
  -G # : same as -g, but uses gradient info of fuction during fit (i.e., a different fit routine).
 +
  The -G version seems a bit buggy.
 +
  -n : normalize the Gaussian fom (shouldn't affect individual fits, just allow comparison between fits
 +
 
 +
Phase 2: options related to "paths" over time:
 +
  Maxima must exist for 0 time pts, be stationary for 0 time pts prior to disappearing
 +
  While a maxima is present, a pixel within range only counts as part of object
 +
  if above threshold (-t option)While a maxima is present,
 +
  a region will only be considered if size (pixels > thresh and within range) is within size (-s)
 +
  and iod is within iod (-i option).
 +
  -iodsize #           check iod within +/- range pixels., default = 3
 +
  -maxspeed #   max distance a maxima can move (in pixels) between time points, default = 5
 +
  -diststill #          how far (in x or y) in pixels a maxima can move and still be considered "still",
 +
  (this is the location compared to last position of maxima) default = 0
 +
  -fall time frac   maximum # of time pts peak intensity can take to show the specified fractional decrease
 +
  when vesicle is fusing. default = 10 and 0.300000
 +
  -iodrise frac   the fractional increase in iod which must be seen
 +
  when vesicle is fusing (see -fall). default = 0
 +
  -check_max #   vesicle must also change from max to not a max within # timepts after fusing
 +
  -minpeakval #          peak intensity value must exceed this when vesicle is fusing (-fall time  parameter)
 +
  -primedtime # #   minimum and max # of time pts vesicle must be primed before fusing.
 +
 
 +
options related to output:
 +
  -debugpath x y z      print out debug info about the path that passes near (within 5 pixels) here
 +
                        (fgrep output for the word: debugpath). can be used 10 times. 1-indexed.
 +
  A -1 for z, means debug any path near x and y, regardless of z value (only if -L used).
 +
  -neardebug #        for -debugpath, definition of near, in pixels, default = 5
 +
  -onlydebug      : only print out info for debug paths. ignore all other paths.
 +
  -a : print all info about each object found (like countobjs does) rather than just summary stats
 +
                      : for each time point.
 +
  -o outimage : create an ouput image of marked objects (object ids reused each time point). Max of each
 +
: object will be marked with the negative of the object id.
 +
  -fit_model : fit a square wave to intensity profile of each vesicle found to be fusing (and to debugpaths)
 +
                        not used for anything yet.
 +
  -v : verbose
 +
  -V : very verbose. may produce huge files. put this as first option to get option parsing info out.
  
 +
Examples:
 +
max2d_simple -t 50 inputimage.i2i -p max.pts
 +
exo4 -v -r mask.rpts -d 600 -b 1 -w 100 -jump 20
 +
  -strict_max -readmax max.pts  -s 10 1000 -i 10 1000000 -t 1
 +
      -duration 20 -timestill 20 -maxspeed 5 -iodsize 5 -diststill 2
 +
      -rise 25 .3 -fall 15 .3 -iodrise .1 -minpeakval 60 primedtime 30 90
 +
      -neardebug 2 -debugpath 152 161 237 -debugpath 134 124 -1 
 +
      inputimage.i2i >& inputimage.out
 +
graph_exo3.csh inputimage.out,  which does the following:
 +
    findpaths_exo3.pl -trackxmgr=tmpavg.xmgr inputimage.out
 +
    findpaths_exo3.pl -trackxmgr=tmppeak.xmgr -peak inputimage.out
 +
    findpaths_exo3.pl -trackxmgr=tmpfit.xmgr -finalfit inputimage.out
 +
    findpaths_exo3.pl -trackxmgr=tmpdist.xmgr -distance inputimage.out
 +
    xmgr -graph 0 tmppeak.xmgr tmpfit.xmgr -graph 1 tmpavg.xmgr -graph 2 tmpdist.xmgr &
 +
in xmgr: Edit->Arrange Graphs, select all the graphs, then set rows to 3,
 +
        Edit-Preferences set Crosshair cursor, linked scrolling.
 +
findpaths_exo3.pl -trackrpts=tmp.rpts -printfusion=4 inputimage.out
 +
addlines inputimage.i2i tmp.rpts - | play -P -1 R -P -2 G -
 +
dave -n 0 -u -K -I inputimage.i2i tmp.rpts
  
 +
source code in /home/lml/krypton/facil
 
see also:
 
see also:
/home/lml/krypton/Corvera/Raz/README 5/15/14
+
  objs_via_ascent,  ~lml/krypton/Huang/TIRF4/found4.pl, run7
align_quadrants.pl
+
#/home/lml/krypton/bin/exo4
recalc_quadrant.pl
+
 
combine_images
+
 
combine_images.pl
+
</nowiki>
register_images.pl
+
===  exo6  ===
insert_image2
+
<nowiki>
 +
This programs find vesicle fusion events in a 2D time series.
 +
 
 +
Each maxima (-readmax) gets a size and iod associated with it.  Only pixels > threshold (-t)
 +
within the iod region (-iodsize) count toward the iod and size.  Once the maximum disappears
 +
(-nomax_length) the region centered around the previous location of the maximum is used.
 +
Maxima are tracked from one time pt to the next by finding the closest maxima (within -maxspeed)
 +
to its previous location. Tracks continue after the maximum disappears for -nomax_length time pts.
 +
 
 +
At the end of this time, the path is then analyzed to see if it meets criteria for a fusing vesicle.
 +
All time pts during which the maxima exists must have an iod within the correct range (-i) and
 +
and correct size (-s). The fusion time is identified by the intensity of the maxima falling
 +
fast enough and far enough (-fall); while within the same interval the iod rises enough (-iodrise).
 +
Fusion time is then further refined to be the time of largest iod increase (between adjacent time pts)
 +
within this interval.
 +
 
 +
A fusion event may also need to be the correct time interval from when the maxima disappears (-check_max).
 +
It may also need to be significantly brighter than the background (-minpeakratio).
 +
It may be required to have a minimum peak value during fusion (-minpeakval).
  
 +
Once the fusion time is found, the program finds the stationary (-diststill) time interval prior to fusion.
 +
This (priming) time interval must be within certain constraints (-primedtime) for the path to be considered
 +
representing a valid fusion event.
 
   
 
   
===  register_images.pl  -h  ===
+
exo6 is similar to exo4 but reads in one time point at a time, there is no concept of a "window"
 +
It only works on a 2D time series
  
Takes a bunch of images taken in one well on the microscope, translates them
+
Usage:
based on ChainedTrans.txt and combines them into one big image.
+
  exo6 [options] -readmax max.rpts inimage.i2i  > inimage.count
 +
 
 +
Options:
  
ChainedTrans.txt should be a partially ordered file with entries like
+
options related to input:
X02:X03    (685,282):(736,287)  
+
  -T startt stopt : only examine these time points (0-indexed, inclusive)
This means that location (685,282) in file X02 is the same as location (736,287) in file X03.
+
  -r rptsfile : read in rptsfile. should have one closed object in it. Uses this as a mask for all the planes.
By partially ordered I mean that for file1:file2  file1 should already have been the
+
  -d tdim : the time dimension of the image (over-rides anything stored in the header)
right hand side of a similar line previously (so its position is already defined relative to
+
  -b #: : blur (smooth) image before looking for objects (maxima), using a window of the specified
the file on the left hand side), unless it is the very first line in
+
: halfwidth (in pixels) in x,y, and z (z width will be set to 0 if 2*width > zdim).
the file. So every right hand side is relative to a left hand side which has already
+
  -readmax file : read maxima in from the specified file (this is REQUIRED)
had its position defined.
 
Output goes to new_trans.i2i
 
  
register_images.pl [options] ChainedTrans.txt
+
options related to finding fusion events:
-out=filename.i2i name of output file produced. default = newimage.i2i
+
  -t threshold : any voxel > threshold in inimage.i2i is tracked to a 3d maxima (default = 0.0).
-post=string the rest of the filename after what is in ChainedTrans.txt, eg, if the file is named
+
  -i miniod maxiod : erase all objects whose iod doesn't fall in the specified range (default: 1-1000000000)
X01_0_0_1.i2i, -post=_0_0_1.i2i (this is also the default for post if not specified).
+
  -s minsize maxsize : erase all objects whose size (in voxels, inclusive) doesn't fall in the specified range
-xdim=# size of original each original image (before recaling by maxtrima, see example below). default = 1392.
+
  (default = 1-1000000). note: object size and iod might be large since all voxels which
-ydim=# default = 1040
+
  connect up via steepest ascent algorithm to the maximum count in this first phase.
-zdim=# default = 21
+
  -iodsize #           check iod within +/- range pixels., default = 3
-xscale=# binning done by matrixima (see example), coords will be scaled by this. default = 4.
+
  -maxspeed #   max distance a maxima can move (in pixels) between time points, default = 5
-yscale=#
+
  -diststill #         how far (in x or y) in pixels a maxima can move and still be considered "still",
-blend when combining images, blend the values where they overlap (default is to just replace any previous
+
  (this is the location compared to last position of maxima) default = 0
value with the new value).
+
  -fall time frac   maximum # of time pts peak intensity can take to show the specified fractional decrease
    -dummy
+
  when vesicle is fusing. default = 10 and 0.300000
-debug
+
  -startfall time   how close (in timepts) in time the peak intensity must start to fall in relation
-h
+
  to the fusion time (biggest jump in iod between two consecutive time pts). default = 1
 +
  -iodrise frac   the fractional increase in iod which must be seen
 +
  when vesicle is fusing (see -fall). default = 0
 +
  -check_max min# max#   vesicle must also change from max to not a max >= min# timepts and <= max# timepts after fusing
 +
  -nomax_length #        only analyze a path # time pts after max first disappears
 +
                        the default (which is also the minimum allowed value) = 1
 +
  -minpeakval #          peak intensity value must exceed this sometime while vesicle is fusing (-fall time  parameter)
 +
  default value = 0
 +
  -minpeakratio ratio# time# dist#:    the ratio of maxval/(median bkgnd value) must >= ratio# within
 +
  time# time steps of fusion.
 +
  bkgnd values are those pixels whose distance from max is >= dist# and <= iodsize
 +
  defaults: not to check this at all
 +
  -primedtime # #   minimum and max # of time pts vesicle must be primed before fusing.
  
 +
options related to speed:
 +
  -nomedian   if -minpeakratio is defined, this causes the avg bkgnd value to be used instead
 +
  of the median value (calculation of median can be expensive).
 +
  -buffered_read #   read # z planes at a time to speed up disk I/O. Default is 1 z plane at a time
  
-shift no circular shift (see tranima). old.  
+
options related to output:
note: tranima will pad images with -32768 which play will show in red (I think) and DAVE will be bothered by.
+
  -debugpath x y z      print out debug info about the path that passes near (within 5 pixels) here
 +
                        (fgrep output for the word: debugpath). can be used 10 times. 1-indexed.
 +
  A -1 for z, means debug any path near x and y, regardless of z value (only if -L used).
 +
  -neardebug #        for -debugpath, definition of near, in pixels, default = 5
 +
  -onlydebug      : only print out info for debug paths. ignore all other paths.
 +
  -a : print all info about each object found (like countobjs does) rather than just summary stats
 +
                      : for each time point.
 +
  -o outimage : create an ouput image of marked objects (object ids reused each time point). Max of each
 +
: object will be marked with the negative of the object id.
 +
  -v : verbose
 +
  -V : very verbose. may produce huge files. put this as first option to get option parsing info out.
  
example:
+
Examples:
matrixima -row 4 W X Y Z -col 3 01 02 03 -pos 0 -obj 0 -fil 1 new.i2i
+
max2d_simple -t 50 inputimage.i2i -p max.pts
play new.i2i -> ChainedTrans.txt
+
exo6 -v -r mask.rpts -d 600 
        register_images.pl ChainedTrans.txt
+
  -readmax max.pts  -s 10 1000 -i 10 1000000 -t 1
        dave -I new_trans.i2i -K -z 15  # a very big file.
+
      -timestill 20 -maxspeed 5 -iodsize 5 -diststill 2
 +
      -fall 15 .3 -iodrise .1 -minpeakval 60 primedtime 30 90
 +
      -neardebug 2 -debugpath 152 161 237 -debugpath 134 124 -1
 +
      inputimage.i2i >& inputimage.out
 +
graph_exo3.csh inputimage.out, which does the following:
 +
    findpaths_exo3.pl -trackxmgr=tmpavg.xmgr inputimage.out
 +
    findpaths_exo3.pl -trackxmgr=tmppeak.xmgr -peak inputimage.out
 +
    findpaths_exo3.pl -trackxmgr=tmpfit.xmgr -finalfit inputimage.out
 +
    findpaths_exo3.pl -trackxmgr=tmpdist.xmgr -distance inputimage.out
 +
    xmgr -graph 0 tmppeak.xmgr tmpfit.xmgr -graph 1 tmpavg.xmgr -graph 2 tmpdist.xmgr &
 +
in xmgr: Edit->Arrange Graphs, select all the graphs, then set rows to 3,
 +
        Edit-Preferences set Crosshair cursor, linked scrolling.
 +
findpaths_exo5.pl -rptsfile=tmp.rpts -rptstracks -printfusion=4 inputimage.out
 +
addlines inputimage.i2i tmp.rpts - | play -P -1 R -P -2 G -
 +
dave -n 0 -u -K -I inputimage.i2i tmp.rpts
  
source code: ~/krypton/bin/
+
source code in /home/lml/krypton/facil
 
see also:
 
see also:
combine use this on newer images which have spatial information stored in their header
+
  objs_via_ascent,  track_back2, ~lml/krypton/Huang/TIRF4/findpaths_exo5.pl, run7, graph_exo3.pl
parsepos.pl
+
#/home/lml/krypton/bin/exo6
~/krypton/Corvera/Olga
+
 
/storage/big1/lml/Corvera/Olga
+
 
recalc_quadrant.pl
+
</nowiki>
recalc_quadrant2.pl
+
===  find_2d_objs  ===
align_quadrants.pl the simplest manual method of aligning the four images in the well
+
<nowiki>
 +
 
 +
For each z slice (time point) in the image, find 8-connected objects.  Print info to stdout.
 +
Only voxels > threshold can be part of an object (default = 0.000000). Doesn't use much memory (reads in a slice at a time).
 +
Should handle our regular (short int) image format and floating point images.
  
   
+
Usage:
===  smooth_gaps.pl  -h  ===
+
find_2d_objs [options] image1.i2i
   This program applies smooth_gaps to all files named *reduced.i2i
+
Options:
 +
-s min max: object must be within this size in pixels (inclusive), default = 1 100000
 +
-b min max: object IOD must be within this range (inclusive), default = 1.000000 1000000000.000000
 +
-t #: threshold for image1.i2i default = 0.000000
 +
-T #: adaptive threshold. # = pixel intensity/mean intensity for each time pt. must be > # to be in object.
 +
If -o specified, only pixels under the mask counted calculating mean intensity.
 +
-i thresh.i2i: use with -T option if desired. thresh.i2i is used to calculate the threshold intead of image1.i2i
 +
If -o specified, then that mask will also be applied to thresh.i2i.
 +
-n image.i2i: write out new image with all voxels not part of an object set to 0
 +
-z low high: only analyze z slices from low to high (1-indexed, inclusive).
 +
      -o mask.i2i:    apply mask image to before analyzing it. only keep pixels in image1.i2i under mask pixels > 0.
 +
mask.i2i must be in our standard image format (short int). If 3d, only first 2d image used.
 +
  -v: verbose
 +
 
 +
See also: pt_distances, max2d, max3dL, maxima, maxL, maxzL, float2intL, int2float, playexact
 +
            track, max2d_simple, countobjs
 +
 
 +
Example:
 +
        # find all objects between 5 and 30 pixels, minimum iod of 200, above a threshold of 100, write out new image:
 +
    find_2d_objs -t 100 -s 5 30 -b 200 1e9 -n newimage.i2i image.i2i > image.objs 
 +
 
 +
Source code in ~krypton/lml/facil 
 +
 +
</nowiki>
 +
===  find_blobs  ===
 +
<nowiki>
 +
/home/lml/krypton/bin/find_blobs
 +
insufficient number of arguments
 +
This program pads an image in z, then calls "invariant" (with -F 10) to produce multiple resolutions
 +
of the original image along with its 2nd derivative in the gradient direction.
 +
The blurred originals are used to find the location of the maxima. The derivative images should
 +
have a zero crossing at the inflection points (eg, "edges"). The maxima should be in regions with
 +
negative second derivative. This program then calls flood2zero to find the spatial extent of each
 +
"blob" (bright region surrounding the maxima). Ideally this should just be a flood fill until
 +
the zero crossing is found, but noise, etc. means that a lower threshold works better.
 +
 
 +
USAGE: find_blobs [options] inputimage.i2i outputroot
 +
 
 +
output extensions of files produced (in same directory as inputimage.i2i):
 +
      .ppts          padded points coords (location of maxima in blurred, but not deriv, image).
 +
      .pts            unpadded points, with z value transformed back to unpadded coordinates
 +
      .bpts          unpadded points after filtering to keep bright points (\>= min_intensity)
 +
      .dpts          bpts with "unordered" -> "ordered" and "break" -> "#moveto", for display in DAVE
 +
      _bres#.i2i      blurred, but no derivatives, at resolution level = # (bigger # = lower res.)
 +
      _dres#.i2i      blurred & derivatives taken, at resolution level = #
 +
      _dres#_obj.i2i  objects found in *_dres#.i2i by floodfilling from points in *.bpts
 +
      _dres#.obj      statistics on *_dres#_obj.i2i
 +
      _flood.out      output from flood2zero
 +
      .out            output from invariant
 +
 
 +
 
 +
options: 
 +
    -m #:   any maxima less than this will get filtered out, default = 1
 +
    -d #:   any derivative voxel with a value >= # will stop the flood fill
 +
                  this is in the original, floating point coord system (prior to 
 +
                  rescaling to write out deriv. image). default = -5
 +
    -p #:   pad data in z so that we don't have wrap around problems, default = 10
 +
    -z #:   number of z planes (in original image) to skip in front and back when
 +
                finding blob voxels - the derivative calculation tends to create negatives
 +
                  in the first and last few planes. default = 2 
 +
    -r #:   number of resolutions to calculate, default = 1
 +
    -e #:   maximum spatial extent of object in pixels (ie, radius), default = 5
 +
                    this is needed since the floodfill can otherwise escape and fill huge
 +
                    volumes (the first and last z slices tend to be all negative, along with
 +
                    negative values in the background regions).
 +
    -s #:    maximum number of voxels in object, default = 300
 +
    -N #:   normalize image prior to use so its max = #, default = 10000
 +
    -b sigx sigy sigz:  standard deviation,in pixels, of Gaussian used in blurring
 +
                    (passed as args for -s option of invariant), default = 2 2 1
 +
 
 +
examples:
 +
 
 +
    find_blobs control3cluster4r_r_cell.i2i c3c4F10
 +
    dave -n 0 -u -z 1 -I control3cluster4r_r_cell.i2i -I c3c4F10_dres0_obj.i2i -S 2 1 0 c3c4F10.dpts
 +
 
 +
source for this cshell script is in /storage/big1/lml/was_invitro/unc/curvature
 +
 +
</nowiki>
 +
===  find_vessels  ===
 +
<nowiki>
 +
 
 +
This program takes an image and scans it vertically in y at dx intervals.  It counts the number of
 +
times a vessel of at least the specified width is entered.  A vessel is any pixel with the specified
 +
intensity value.  Each z slice in analyzed separately (and read in sequentially).  A count of vessels vs time and dx displacement is
 +
written to stdout.
 +
See /home/lml/krypton/Corvera/grant2010.
 +
 
 +
Usage: find_vessels [options] image.i2i
 +
options:
 +
  -z start stop: zplanes to analyze. 0-indexed inclusive. default is all z planes
 +
  -i #: intensity of a pixel in the vessel. default = 32767
 +
  -w #: minimum vertical width of vessel in pixels, default = 2
 +
  -d #: dx step size, default = 100
 +
  -v: verbose
 +
 
 +
Source in /home/lml/krypton/facil
 +
See Also:
 +
Examples:
 +
 +
</nowiki>
 +
===  fit3gaussians  ===
 +
<nowiki>
 +
# /home/lml/krypton/bin/fit3gaussians -h
 +
This fits a 3 component (Gaussian diffusion) model to Joan Politz's data.
 +
 
 +
Usage:
 +
  fit3gaussians [options]
 +
 
 +
Description:
 +
  Fits a three component Gaussian model to time series data.
 +
 
 +
Options:
 +
  -a      : rather than having data fit a 3D diffusion model, have it fit a 2D model.
 +
  -d # #  : only look at data sets from # to # (inclusive, first data set = 0).
 +
            timings for the available data sets are (in seconds after uncaging):
 +
before_uncaging  0.050000  0.550000  1.050000  1.550000  11.550000  21.549999 
 +
31.549999  0.000000  0.000000  0.000000  0.000000  0.000000 
 +
0.000000 
 +
            default data sets to look at are 1 to 4
 +
  -e # #  : change the time in dataset # (0-indexed) to # (in seconds)
 +
  -f file : file name for test data (as produced by "distances" program).
 +
  -F file : file name for times for all the datasets from file, one time per line.
 +
            this also changes the default range to be all the sets
 +
            (use -d after this on the command line if you want to change the sets used).
 +
      note: there must be less than 1000 datasets.
 +
  -n # #  : number of function parameters and variances used for
 +
            each parameter (default 10 paramters and  5 variances)
 +
  -p # #  : set function parameter number to some value (first # can be 0 to
 +
            the maximum number of parameters)
 +
  -s # #  : set function paramter # start value to some value (first # can be 0 to
 +
            the maximum number of parameters)
 +
  -S # #  : set function paramter # variance value to some initial value (first # can be 0 to
 +
            the maximum number of parameters)
 +
  -r # # #: set function paramter # range values to some initial values (first # can be 0 to
 +
            the maximum number of parameters)
 +
  -t #    : maximum number of random trials to search for parameters (default=100).
 +
  -T #    : search terminates when # successive times the smallest variance search is best. (default=5)
 +
  -m #    : maximum number of times to perform search, regardless of best variance (default=1000).
 +
  -M #    : maximum number of times try (for each parameter) to find a point within allowed range
 +
            default = 100
 +
  -D func #: print debug info. for specified function at level #
 +
              func 1: ars, levels: 1-4 with 4 being most info.
 +
              func 2: radial search, levels: 1-2
 +
              func 3: finding a test point, levels: 1-2
 +
  -P      :  just print out the data and theoretical curves for the start point and terminate.
 +
 
 +
example (see ~lml/vision/Politz/run)
 +
default settings are:
 +
  t1 in seconds                  : range: -4.900E-02 to  5.500E+00, start: -2.500E-02
 +
  D1 in microns^2/sec            : range:  1.000E-02 to  1.000E+02, start:  5.000E+00
 +
  mag1 in intensity/micron^3      : range:  5.000E+01 to  3.000E+04, start:  3.000E+03
 +
  dc value                        : range:  0.000E+00 to  2.000E+03, start:  2.000E+02
 +
  D2                              : range:  1.000E-01 to  1.000E+03, start:  1.000E+02
 +
  mag2                            : range:  5.000E+00 to  3.000E+04, start:  3.000E+02
 +
  t2                              : range: -4.900E-02 to  5.000E+03, start:  5.000E+02
 +
  D3                              : range:  1.000E-01 to  1.000E+03, start:  1.000E+02
 +
  mag3                            : range:  5.000E+00 to  3.000E+04, start:  3.000E+02
 +
  t3                              : range: -4.900E-02 to  5.000E+03, start:  5.000E+02
 +
 
 +
</nowiki>
 +
===  flood2zero  ===
 +
<nowiki>
 +
 
 +
This program takes an original 3D image, a 2nd derivative image
 +
as produced by invariant -F 9 -b, and a list of 3d maxima and produces
 +
a new image which is just those voxels from orig.i2i that are negative
 +
(the 2nd derivative of a bright spot is < 0) in the derivative image
 +
and connected to a 3D maxima.  So it is used in conjuction with invariant
 +
to identifiy bright blobs (eg, synapses) in a 3D image.
 +
 
 +
Usage: flood2zero [options] orig.i2i deriv.i2i image.pts newimage.i2i
 +
options:
 +
  -b # : which resolution of maxima to use (object=noderiv_maxima# in pts file)
 +
  -v #  : instead of using 0 as the object boundary cutoff, use #
 +
        -z low hi: zrange to examine, zero-indexed, inclusive.
 +
  -d dist: max chessboard distance (in voxels) from each point to flood fill.
 +
  -s size: maximum size in voxels of an object (will truncate to this size), default= 10000
 +
  -o file: save object (blob) statistics to specified file. This is very similar to
 +
what countobjs would produce when applied to newimage.i2i except newimage.i2i
 +
can have blobs which touch (due to the size contraints here) and hence show
 +
up as one large blob instead of two smaller blobs. Also, if the header for the
 +
image has a scale factor in it (which invariant writes) this scale factor will
 +
be used to convert all statistics back into original unscaled values.
 +
 
 +
note: entire image name (with extension) is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
note: a compressed image will be automatically be uncompressed.
 +
[source in /usr/people/lml/invitro/unc/curvature/flood2zero.c]
 +
 +
</nowiki>
 +
===  gsearch  ===
 +
<nowiki>
 +
program to do graph search on a slice of edge image
 +
USAGE:
 +
example gsearch -d name -x # -y # -a # -b # edge.i2i text.gpts
 +
    edge.i2i : magnitude input image
 +
    text.gpts: output is a graph points (gpts) text
 +
file having the same format as rpts file
 +
new boundary is stored under z=slice # (default: 1)
 +
 
 +
Options:
 +
-d  option specifies name of image containing direction of each edge
 +
    pixel of edge.i2i
 +
-k  option specifies constant of proportionality
 +
    to be used with filgra (default: 1.0)
 +
-x  start x coordinate.
 +
-y  start y coordinate.
 +
-a  stop x coordinate.
 +
-b  stop y coordinate.
 +
-h  prints this message.
 +
 
 +
 
 +
Source code in /storage/big1/lml/jac/was_invitro/graph
 +
 +
</nowiki>
 +
===  histogram2  ===
 +
<nowiki>
 +
Usage:
 +
  histogram2 [options] boundary.i2i aimage.i2i bimage.i2i
 +
Description:
 +
  This program creates a number of histograms of intensity or volume as a function of
 +
  distance of the object voxels from the nearest background voxel.
 +
  Requires:
 +
    boundary.i2i - boundary image created with boundary or createBoundary.
 +
object voxels are those with a value of 6
 +
background voxels are those with a value of 4
 +
border voxels are those with a value of 2
 +
all other voxels are ignored.
 +
            NOTE: by default this is assumed to be padded by 7 pixels all around.
 +
                  ie, IT IS LARGER THAN aimage.i2i and bimage.i2i
 +
                  createBoundary does this. see -p if you don't want this default.
 +
    aimage.i2i  - data image a.
 +
    bimage.i2i  - data image b.
 +
  Returns:
 +
    aimage_H.histo - output file with histogram info (-H can change this).
 +
  Output file format (10 columns):
 +
  1. bin number (i.e., distance from background) (each bin = 0.1 pixels)
 +
      note:a pixel touching the boundary is a distance of .5 (center is .5 from edge)
 +
  2. histogram of intensities in image a.
 +
  3. number of pixels in this bin (i.e., volume at this distance).
 +
  4. histogram of intensities in image b.
 +
  5. histogram of intensities in image a > athreshold (intens-thresh if -s option used).
 +
  6. histogram of intensities in image b > bthreshold (intens-thresh if -s option used).
 +
  7. histogram of intensities in image a, where values in a are such that
 +
      if (image a > athreshold)  and (image b > bthreshold), a=a (a-athresh if -s option) else a=0.
 +
  8. histogram of intensities in image b, where values in b are such that
 +
      if (image a > athreshold)  and (image b > bthreshold), b=b (b-bthresh if -s option) else b=0.
 +
  9. # of pixels in image a > image a threshold (at this distance), like 3 but only
 +
      counting voxels > threshold.
 +
  10.# of pixels in image b > image b threshold (at this distance), like 3 but only
 +
      counting voxels > threshold.
 +
 
 +
Input Options:
 +
  -o    :  border pixels are background voxels (default is object voxel)
 +
  -p x y z  :padding in x,y,z included in the boundary image  (default 7 in all directions).
 +
          (boundary image found in the programs boundary and
 +
            createBoundary are by default padded by 7 pixels
 +
            on all sides of the image.
 +
 
 +
Distance Options:
 +
  -P x y z : don't find histogram of all pixels to boundary, just the distance
 +
            of this pixel from the boundary. Can be used multiple times on command line.
 +
            (x,y,z) is 1-indexed (like play) aimage.i2i coordinate values.
 +
  -d #:    maximum distance (in pixels) to check, default = .5*(min dim)
 +
          Any pixel further than the maximum distance is considered to be at the maximum distance.
 +
          This apply also for the -ta and -tb distance based thresholds.
 +
  -x #  :  set x weight to # (default 1.0).
 +
  -y #  :  set y weight to # (default 1.0).
 +
  -z #  :  set z weight to # (default 1.0).
 +
  -F    :  Fast histogram - voxel level (default fast).
 +
  -S    :  Sub-voxel resolution histogram(default fast).
 +
  -Y # #:  limit Y direction from # to # (default off).
 +
          If the long axis of the cell is in the in the y direction,
 +
          and the cell is cut off, using the -Y option will limit searching
 +
          for the boundary in that direction, i.e. the ends past these values will
 +
          not be considered part of the boundary.
 +
          (similarly true for -X and -Z options)
 +
  -X # #:  limit X direction from # to # (default off), inclusive, 1-indexed.
 +
  -Z # #:  limit Z direction from # to # (default off).
 +
  -c:    pixels outside the image are considered border pixels.  For example, if the outlines
 +
          used to create boundary.i2i were in z=1, but you want pixels inside the z=1 boundary
 +
          to be counted as being 1 pixel away from the boundary (eg, from the phantom z=0 slice)
 +
          use this option.
 +
 
 +
Threshold Options:
 +
  -a #  :  set aimage threshold to # (default 0.000000).
 +
  -b #  :  set bimage threshold to # (default 0.000000).
 +
  -s :    subtract thresholds (and then clamp to >=0) rather than simply keeping intensities > threshold.
 +
          This is more like what you might want to do to subtract off background or nonspecific flourescence.
 +
  -ta athresh.txt  :  apply different thresholds at different distances to aimage.i2i.
 +
                    athresh.txt as produced by analyze_histo (applied to -f aimage_H.i2i output)
 +
  (i.e., 2 columns: bin # (tenths of a pixel) and threshold).
 +
  -tb bthresh.txt  :  like -ta, but for bimage.i2i
 +
  -ra # :  rescale athresh.txt prior to use, multiply values in file by #.
 +
  -rb # :  rescale bthresh.txt prior to use, multiply values in file by #.
 +
 
 +
Ouput Options:
 +
  -f aimage_H.i2i xdim ydim:  print out a full histogram of aimage. This is a
 +
          2D image (eg, aimage_H.i2i) with the specified x and y dimensions.
 +
          The x direction is pixel intensity, and the y direction bin number (tenths of a pixel) and
 +
          the pixel value wll be set to the number of voxels at that distance and that intensity.
 +
          Specify -1 for xdim or ydim if you want that dimension calculated automatically
 +
          (xdim will be approx. max intensity in image and ydim about 10*max dist, see -d option).
 +
          Explicitly set the dimensions if you will want to add this image with others (since they must all
 +
          be the same dimensions), e.g., to average data from a set of control files.
 +
          note: -S option will cause the "number of voxels" to appear to change.
 +
          Use the analyze_histo program to produce a distance dependent threshold file from this (e.g. to read
 +
          back into histogram2 on another pass via the -ta or -tb option).  This image can be large (25MB).
 +
  -H file: Output filename for histogram (instead of aimage_H.histo).
 +
  -A aimage_thresh.i2i  :  write out aimage.i2i after threshold is applied (for visualization purposes)
 +
                          these are the pixel values used to produce column 5 of aimage_H.histo
 +
  -B bimage_thresh.i2i  :  write out bimage.i2i after threshold is applied (for visualization purposes)
 +
                          these are the pixel values used to produce column 6 of aimage_H.histo
 +
 
 +
Miscellaneous Options:
 +
  -D distimage.i2i  :  print the distance image (for debugging). Each voxel is 100 times its distance
 +
    from the membrane (a pixel neighboring the background has a distance of .5 pixels).
 +
                      This can also be used by mask_image to then mask desired pixels.
 +
  -h    :  print this message.
 +
 
 +
Notes:
 +
  All the images should be oriented in the same direction.
 +
  Entire image name (with extension) is required.
 +
  A - in place of an image name means stdin or stdout.
 +
 
 +
 
 +
Example:
 +
  create_dcim -d 4 -s 234 294 24 -| addlines -P -1 - rob15_nucleus.rpts -|
 +
            flood -e -1 -E 2 -I 6 -b 4 - mask.i2i
 +
  histogram2 -p 0 0 0 -Z 2 23 -d 40 -a 3552 -b 7767 -z 1.34 mask.i2i rob15f_rtm.i2i rob15r_rtm.i2i
 +
 
 +
Example: use a variable distance threshold to subtract background flourescence from dual labeled images:
 +
    addlines -P -1 control_aimage.i2i control_membrane.rpts -| flood -e -1 -E 2 -I 6 -b 4 - mask.i2i
 +
        # create a full histogram so we can use a variable threshold based upon distance from membrane:
 +
    histogram2 -p 0 0 0 -d 40 -z 1.34 -f controla_H.i2i mask.i2i control_aimage.i2i control_aimage.i2i
 +
        # create the variable threshold file:
 +
    analyze_histo controla_H.i2i > controla_H.thresholds
 +
        # repeat for control bimage (e.g., second wavelength):
 +
    histogram2 -p 0 0 0 -d 40 -z 1.34 -f controlb_H.i2i mask.i2i control_bimage.i2i control_bimage.i2i
 +
    analyze_histo controlb_H.i2i > controlb_H.thresholds
 +
        # now apply these thresholds to the real dual labeled (not the control) data:
 +
    addlines -P -1 real_aimage.i2i real_membrane.rpts -| flood -e -1 -E 2 -I 6 -b 4 - real_mask.i2i
 +
    histogram2 -p 0 0 0 -d 40 -z 1.34 -s -ta controla_H.thresholds -tb controlb_H.thresholds \
 +
                    real_mask.i2i real_aimage.i2i real_bimage.i2i
 +
See Also:
 +
  boundary, createBoundary, analysis, analyze_histo, threshold, nucleus_overlaps, mask_image, Corecell.pl.
 +
 
 +
Source code in /storage/big1/lml/jac/was_invitro/Projects/boundary/boundary
 +
 
 +
 
 +
</nowiki>
 +
===  image2ptsL  ===
 +
<nowiki>
 +
 
 +
This program takes an image, and identifies boundary pixels of objects.
 +
Boundary pixels are foreground pixels which have at least one
 +
backgound pixel among their 8 neighbors.
 +
In addition, any foreground pixel which is on the edge of a 2D
 +
slice is also considered a boundary pixel.
 +
These boundary pixels are written out in "addlines" format.
 +
Each zslice is analyzed sequentially.
 +
Points are unordered, and they are all considered part of one object.
 +
Points in the pts file have their value set to -1
 +
 
 +
Usage: image2pts [options] image.i2i pointfile.pts
 +
options:
 +
  -t #: threshold, above which is foreground. Default = 0
 +
note: entire image name (with extension) is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
note: a compressed image will be automatically be uncompressed.
 +
 +
</nowiki>
 +
===  invariant  ===
 +
<nowiki>
 +
 
 +
This program takes an image, blurs it with a Gaussian of
 +
specified standard deviation and then takes derivatives of the image
 +
It does all of this in the frequency domain.
 +
 
 +
outfile is the root name for derivative of blurred images (outfile_dres#.i2i, unless -M),  plain blurred
 +
images (-b option, outfile_bres#.i2i) and/or pts files (-m or -M options, outfile.pts).
 +
 
 +
Any function which is a ratio of sum of products of derivatives (eg, (LxxLy + LyzLx)/(LyLy+LzLz))
 +
can be calculated.  Edit file init_invariant.c in
 +
/usr/people/lml/invitro/unc/curvature and recompile on molmed if you want a function which
 +
is not listed here.
 +
 
 +
Usage: invariant [options] infile.i2i outfile
 +
options:
 +
  -F #:  function to calculate.  Default = 1. Available functions are:
 +
  -F 1: LxLx+LyLy+LzLz : 3D gradient squared
 +
  -F 2: .5(Lxx+Lyy+Lzz)/sqrt(LxLx+LyLy+LzLz) : normalized 3D Laplacian
 +
  -F 3: LxLx+LyLy : 2D gradient squared
 +
  -F 4: sqrt(LxLx+LyLy) : 2D gradient
 +
  -F 5: 2(LxxLyy-Lxy^2)/(Lxx^2 + Lyy^2 + 2Lxy^2): 2D light or dark blobs (p. 252 IPMI '91)
 +
  -F 6: 2(LxxLyy-Lxy^2), same a -F 5, no normalization (so noise isn't magnified).
 +
  -F 7: mean curvature of 3D isointensity surface normalized by gradient squared
 +
  -F 8: mean curvature of 3D isointensity surface, no normalization.
 +
  -F 9: 2nd der. in the grad. direction times gradient squared.
 +
  -F 10: 2nd der. in the grad. direction (should = 0 at locations of edges)(use -u option).
 +
  -F 11 XYZ    e.g., -F 11 021  take zero derivatives in X direction, 2 in Y, 1 in Z (Lyyz).
 +
by calling invariant multiple times with various XYZ and using the -g option you
 +
can create a bunch of derivative images which you can then read in and combine
 +
however you like (e.g., my curvature_eigenvectors program)
 +
  -N #: normalize image intensities prior to use to be between 0 and #
 +
this performs: newval = #*(val-minval)/(maxval-minval)
 +
  -u #: during division (-F 2,5,7,10) set divide by 0 to this integer, default=0.
 +
        note: this is the final output pixel value, after any scale factors (-r or -R).
 +
        a good value is -32768, the minimum possible output pixel value.
 +
  -s sigx sigy sigz:  standard deviation in spatial domain of Gaussian.
 +
  -S sigx sigy sigz:  standard deviation in frequency domain of Gaussian.
 +
default = 3.402823E+38  3.402823E+38  3.402823E+38
 +
  -l # res2 res3 ... :  # = number of different resolution levels to calculate.
 +
res2 ... res# are the relative sigmas for each resolution level after
 +
the first one. eg, -l 3 .9 .7  means that 3 blurred levels should
 +
be calculated and the sigma (in the freq domain) of the second
 +
level should be .9 of the first level (ie, more blurred), and the 3rd
 +
level should be .7 of the first level (as specified with -S).
 +
  -L # factor:  # = number of resolution levels. factor is the relative sigmas in
 +
the spatial domain for each level relative to the previous level.
 +
  -e epsilon:  cutoff for Gaussian intensity calculation.
 +
default = 0.040000
 +
  -r: apply scalefactor to output so min= -32766 or max= 32766. This is useful
 +
especially when all the values would otherwise be < 1.
 +
This also prints to stderr the min and max values before rescaling.
 +
  -R #: rescale output by multiplying all values by #.
 +
  -m: calculate coords of 3D maxima after blurring and taking derivatives.
 +
Creates an outfile.pts file.
 +
  -M: same as -m, but also prevents writing out blurred images.
 +
        -b:         calculate coords of 3D maxima after blurring (but before derivatives). This
 +
        can be used with the -m option.  Objects associated with this option will
 +
        be named "noderiv_maxima#", where # is the resolution number.
 +
        This is useful for passing to flood2zero to find the extent of the bright spots.
 +
Also writes out blurred images (outfile_bres#.i2i).
 +
  -B: same as -b, but prevents writing out the blurred images.
 +
  -n #: maxima must have an intensity > # (must use -m, -M, or -b with this)
 +
  -f #: max pixel must be > all neighbors by at least # to be a maxima. default = 0.000100
 +
  -g: output a floating point image (no rescaling done). This output can be used
 +
by my curvature_eigenvectors program. -u option still applies.
 +
 
 +
note: image dimensions which factor to 2, 3, or 5 go fastest with the FFT.
 +
note: the entire image name is NOT required.
 +
note: compressed images will be uncompressed.
 +
note: a - in place of an image name means stdin or stdout.
 +
see also: max3d, multi_gauss_deriv, flood2zero, find_blobs, blur_spatial, canny, zerosu.
 +
source in /storage/big1/lml/was_invitro/unc/curvature
 +
/home/lml/krypton/bin/invariant
 +
 
 +
</nowiki>
 +
===  linux_epr_x86_64-7-12-2012  ===
 +
<nowiki>
 +
 +
 
 +
epr                              UMMC/BIG                          Jul 12 2012
 +
 
 +
NAME
 +
    epr - Exhaustive Photon Replacement (EPR) restores contrast by removing
 +
    residual out-of-focus light and improves resolution while maintaining
 +
    numerical accuracy of 3-D images of specimens obtained with serial
 +
    optical sectioning from wide-field or confocal light microscopy.
 +
 
 +
SYNOPSIS
 +
    epr [options] before-image[.tif] after-image[.tif]
 +
 
 +
DESCRIPTION
 +
    epr performs regularized, iterative image restoration with a non-
 +
    negativity constraint.  The before-image is a three dimensional (3-D)
 +
    TIFF image composed of rectangular, regularly spaced, optical sections.
 +
    Large images are decomposed into smaller, overlapping (in x and y only)
 +
    image segments for restoration, and the restored segments are recomposed.
 +
    The after-image is the restored 3-D image. All options must appear
 +
    before the image file names, but the order of options is not important.
 +
 
 +
    epr has the following options:
 +
 
 +
    -h                Prints basic help on syntax and available options.
 +
 
 +
                              Required Parameters
 +
 
 +
    -psf file[.tif]  The 3-D point spread function image file. The psf must
 +
                      match the optical configuration used for the before-
 +
                      image.  The psf depth (number of z-planes) need only be
 +
                      less-than or equal-to twice that of the before-image.
 +
                      Extra z-planes are symmetrically discarded.
 +
 
 +
    -smoothness alpha The alpha value where alpha is typically 0 < alpha < RNL.
 +
    -sm alpha        RNL is the residuals noise limit as reported by prepdata
 +
                      (see also). Smaller values of a correspond to less
 +
                      smoothing.  (RNL)^2 is usually a good starting choice for
 +
                      alpha.
 +
 
 +
    -iterations n    Maximum number of iterations to perform.  Iterating may
 +
    -it n            terminate earlier if convergence is detected. (see
 +
                      -convergence)
 +
 
 +
                              Control Parameters
 +
 
 +
    -scaling n        where n is after image scaling factor. Used to prevent
 +
    -sc n            integer overflow when saving after image to file.
 +
                      Default=1.0
 +
 
 +
    -convergence n    Criteria for terminating iteration, where n is << 1.
 +
    -co n            0.00001 represents true convergence. 0.001 usually
 +
                      achieves 90-95% convergence in about half the number
 +
                      of iterations.  Values of n larger than 0.001 are not
 +
                      generally recommended. Default=0.001
 +
 
 +
    -axial n1 n2      The z-axis object extrapolation beyond the sectioned
 +
    -ax n1 n2        image data where n1 is before first plane and n2 is
 +
                      after last plane. n is in planes.  By default,
 +
                      extrapolation extends +-1/2 the z-axis extent of the point
 +
                      spread function image and should be sufficient. Smaller
 +
                      values of n1 or n2 have the effect of spatially
 +
                      constraining the restored object and should be applied
 +
                      carefully.
 +
 
 +
    -time n1          The timepoint where you want the restoration to occur (0 indexed)
 +
    -t n1
 +
 
 +
    -threads n        The number of threads FFTW should use. Default=1
 +
    -th n
 +
 
 +
    -transverse n    The x-axis and y-axis object extrapolation in pixels.
 +
    -tr n            The epr process extrapolates the restoration beyond the
 +
                      bounds of each image segment in order to account for
 +
                      exterior out-of-focus contributions. Default = 1/4 of X or Y
 +
                      dimsenion PSF width, which ever is larger.
 +
 
 +
EXAMPLES
 +
    To see the command line syntax
 +
 
 +
      % epr
 +
    or
 +
      % epr -h
 +
 
 +
    Given specimen image mycell_.i2i and point spread function image mypsf_.i2i
 +
      let smoothness equal 0.0005, maximum number of iteration equal 250
 +
      and convergence equal 0.001. Perform single-resoltion(default) EPR:
 +
 
 +
      % epr -psf mypsf_ -smoothness 0.0005 -iterations 250 mycell_ mycell_r
 +
 
 +
FAQ (Frequently Asked Questions)
 +
 
 +
      see  http://...
 +
FILES
 +
        xcomp:/home/epr/epr
 +
        xcomp:/home/epr/cs_epr.lo
 +
 
 +
SEE ALSO
 +
        prepdata
 +
        preppsf
 +
 
 +
 
 +
</nowiki>
 +
===  many_overlapsL  ===
 +
<nowiki>
 +
insufficient number of arguments
 +
 
 +
This shell script calls overlap many times for a range of thresholds
 +
in both images.
 +
Unknown options are passed to overlap.
 +
Output is put into the specified output file
 +
This should then be processed by the program: create_images
 +
Note: a temporary file is created in the current directory.
 +
See also: create_images, overlap, probcolocal
 +
 +
USAGE: many_overlaps [options] image1.i2i image2.i2i output
 +
options:
 +
  -t low hi step :range of thresholds for image1.i2i
 +
default = 1, 101, 10
 +
  -T low hi step :range of thresholds for image2.i2i
 +
default = 1, 101, 10
 +
 +
</nowiki>
 +
===  map_to_surface  ===
 +
<nowiki>
 +
error: 
 +
There should be 3 or 5 main arguments (exluding options).
 +
Arguments seen:
 +
This program takes a surface (which are those voxels which are nonzero)
 +
and one (or two) data images.  It then maps (moves) the data voxels (nonzero
 +
voxels) to the position of the nearest surface voxel.  When done, one (or two) new
 +
image is produced which has the data values at these new positions.
 +
In addition, some statistics about the mapping are printed to stderr.
 +
 
 +
NOTE:A surface can be generated by Simple_2D_wrap or shrink_wrap.  This "mesh"
 +
representation of the surface (which DAVE can display using the -i option)
 +
can be converted into a surface .i2i image for map_to_surface using
 +
/usr/people/jac/cell/bin/make_surface -I surface.i2i -c 1 mesh.i2i surface.rpts
 +
The resulting surface is made up of voxels.  Voxels which are just below the
 +
surface will be considered to be a distance of 1 voxel from the surface
 +
(the distance between the centers of the two voxels).
 +
 
 +
Usage:
 +
  map_to_surface [options] surface.i2i image.i2i out_image.i2i [image1.i2i out_image1.i2i]
 +
Options:
 +
 
 +
a second input image and output image can be specified on the command line.
 +
 
 +
-c: rather than mapping data values to the nearest surface voxel, map
 +
a count of the number of data values which mapped to the
 +
surface voxel. I.e., if 2 data voxels mapped to a surface voxel, a
 +
2 is stored there (rather than the max of the 2 data values-the default).
 +
-b: rather than mapping data values to the nearest surface voxel, or
 +
a count, just map a 1 (ie, binary) onto the surface where ever a data
 +
voxel maps (regardless of how many map there or their intensity).
 +
-m: surface.i2i is actually a mesh file, not an image file
 +
produced from a mesh file.  In this case, only map data
 +
values to surface vertices (since map_to_surface doesn't
 +
yet know how to convert mesh files to complete surfaces
 +
like make_surface).
 +
      -d #:  minimum distance (in voxels) which data must be from the surface and
 +
still be mapped onto it.  Data closer than this is ignored.
 +
By default all data is examined (ie, min_distance = 0)
 +
      -D #:  maximum distance (in voxels) which data can be from the surface and
 +
still be mapped onto it.  Data further than this is ignored.
 +
By default all data is examined (ie, max_distance = 1/2 the minimum
 +
image dimension, this should include all of the data).
 +
      -x:    exclude data voxels which are already on the surface (they will be zeroed).
 +
(note: setting the minimum distance > 0 will not achieve the same effect since
 +
that would still allow a data voxel on the surface to match to a surface
 +
voxel at a neighboring position).
 +
 
 +
Source code in /storage/big1/lml/was_invitro/Moore/pkc
 +
 
 +
</nowiki>
 +
===  min_cylinder  ===
 +
<nowiki>
 +
MIN_CYLINDER program - Version 1.0
 +
 
 +
This program takes an initial cylindrical mesh surface
 +
and allows it to deform to minimize a function of
 +
surface curvature and stretch and image intensity
 +
 
 +
Usage: min_cylinder [options] insurface infile outsurface
 +
 
 +
OPTIONS CONTROLLING TERMINATION CRITERIA:
 +
[-n #] Maximum iterations
 +
[-c #] Minimum pixel changes per iteration
 +
 
 +
OPTIONS CONTROLLING SURFACE SHAPE:
 +
[-w # # # # # #] Weights for Su Sv Suu Suv Svv E
 +
default = 0.20, 0.20, 0.10, 0.20, 0.10, -0.10
 +
NOTE: for a 2D time series, the u
 +
direction is usually in the xy plane
 +
and v is the time direction.
 +
-b:  use bilinear interpolation along the u coordinate
 +
      direction to calculate the energy component due to
 +
      the data. This option only works in conjunction with
 +
      the -D option. This causes all data along the boundary
 +
      in each xy plane to contribute to the energy of the
 +
      surface, instead of just voxels at the locations of the
 +
      vertices of the surface.
 +
      NOTE: does not use weights specified by -W option yet.
 +
-a:  same as -b but the average energy along the boundary is
 +
      calculated instead of total, so long lines are not preferred.
 +
-p:  same as -a but the average energy along each boundary segment
 +
      is weighted by the percentage of total boundary length which
 +
that segment contributes. So long bad lines count more than
 +
short bad lines.
 +
-g:  weight the data along the boundary by the dot product with the
 +
unit length vector normal to the gradient. Thus boundary segments which
 +
are parallel to the data gradient direction will count less than
 +
they otherwise would. Use with -b, -a, or -p option.
 +
-z #: the cost of a zero length line (before applying w6)
 +
      default = 0, only valid with -a or -b option.
 +
-N: use "normal" curvature instead of parameterization
 +
dependent curvature calculation.  This option should produce
 +
a more correct curvature calculation, so the program does not
 +
get fooled into thinking that small objects have smaller
 +
curvature.
 +
 
 +
OPTIONS CONTROLLING ALLOWABLE SURFACE MOVEMENT:
 +
[-D]  Restrict movement to 2 dimensions (x & y)
 +
[-s]  Skip first and last planes of cylinder
 +
      (so they won't move at all).
 +
[-S filename] filename of z planes to skip (do not use with -s).
 +
[-f]  Fix first and last planes of cylinder to move only in x&y
 +
[-F filename] filename of z planes to fix to move only in x&y
 +
(do not use with the -f option).
 +
[-A]  when the -F or -S flag specified, normally if two adjacent
 +
      slices are specified in the rpts file then the surfaces on
 +
      either side of these become independent of the each other.
 +
      If -A is specified then they will still affect each other.
 +
 
 +
OPTIONS CONTROLLING INPUT, OUTPUT, AND DEBUGGING INFO:
 +
[-W # # #] Weights for scaling x y z dimensions.
 +
[-r rescale]  rescale image data from 0 to rescale
 +
before using. default = 1000.000000
 +
    If rescale <0 then no rescaling will be done.
 +
[-u]  expect input image to be i2i - output also i2i.
 +
[-I #] write out vertex coords every # images
 +
      written in unc image format. can be read
 +
      in and displayed by wire. If SAVE_ENERGY is
 +
  defined then energy of each vertex also saved.
 +
      Currently SAVE_ENERGY is defined.
 +
[-i]  Copy information fields flag
 +
[-t "title"]  New image title
 +
[-d #]  Debugging level, 1 (least) to 2 (most)
 +
 
 +
See also: Simple_2D_Wrap, 2D_wrap, shrink_wrap
 +
 
 +
</nowiki>
 +
===  morph3d  ===
 +
<nowiki>
 +
 
 +
This program does morphological processing on greyscale images. Currently the
 +
default intensity it filters with is a constant, although different shapes and
 +
intensity profiles are allowed.  Think of a 2d image as a 3d binary array of voxels
 +
where the height dimension is the intensity of the image at this x,y position.
 +
All those pixels which are less than or equal to the height are 1, others are zero.
 +
This object (made up of voxels which are 1) is the UMBRA of the image.
 +
 
 +
Dilation: Take the umbra of
 +
the image and the umbra of the filter. Then the image dilated by the filter is
 +
those voxels which get "reached" by the filter voxels when the filter umbra
 +
is translated through the image umbra (i.e., move the origin of the filter umbra
 +
everywhere inside the image umbra, all those voxels ever reached by the filter are
 +
part of the dilated umbra).
 +
For a constant intensity filter this reduces to just taking the
 +
maximum of the image intensities at the filter's locations.
 +
 
 +
Erosion: similar to dilation, but now as you move the filter around, only keep
 +
those voxels which, when the filter umbra is centered on them, permit all the
 +
filter voxels to lie on top of image voxels (i.e., the filter umbra fits inside
 +
the image umbra when centered on that voxel).Erosion is dilation of the background.
 +
This reduces to a minimum for a constant intensity filter.
 +
 
 +
Opening: erosion followed by dilation, can be visualized by taking the filter umbra
 +
surface and pushing it hard up under the image umbra surface. The highest voxels
 +
reached by the filter surface represent the new filtered image surface.
 +
(e.g. the "solvent or probe accessible surface" from below.
 +
 
 +
Closing: dilation followed by erosion.  Dilation can be visualized as
 +
flipping the filter umbra and rolling it along the top (outside) of
 +
the image umbra and recording the lowest voxels reached. (e.g.,the solvent
 +
accessible surface from above.).
 +
 
 +
If a 3D image is input, and a 3D filter shape is specified, then all analysis
 +
is done using 3D morphological filtering.  If a 2D filter is specified, then each
 +
zplane is analyzed separately.
 +
 
 +
Usage: morph3d [options] inimage.i2i outimage.i2i
 +
options:
 +
  -v: verbose, prints out which z slice is being analyzed to stderr.
 +
  -b #: any pixels <= # are background, ignore them. default = -32766
 +
  -h #: the maximum height (intensity) of the filter center relative to other
 +
                      entries in the filter. The default =0, ie all entries in the
 +
                      filter are at the same height.  If a nonzero value is specified
 +
                      a linear falloff in height to zero at the edges of the filter is
 +
                      assumed.
 +
  -m: when -m is specified the filter's intensities must fit under the
 +
image intensities without any intensities going negative. If this
 +
not the case, then a zero value is put in that center pixel location.
 +
For example, if we specify a filter which is 100 brighter in the
 +
center than at the edge, and the filter is over a region that is 50
 +
brighter in the center, then (if -m is not specified) that pixel value
 +
might stay 50 (since the template can fit under the image intensity by
 +
lowering itself so its edges have negative values).  If -m
 +
is specified, the filter will not fit and the pixel will get set to 0.
 +
  -f #:  morphological filter shape. 6 = jack (ie, 3D cross, default)
 +
7= 3D asterisk, 4 = 2D plus
 +
1= 2D filled square, 8 = 3D cube, 2= 2D filled circle,
 +
3= 2D asterisk, 5= 2D cross.
 +
2D shapes are done one zslice at a time.
 +
  -l #: just use a single LINE, of specified orientation .
 +
1 = LL-UR, 2 = UL-LR, 3 = Left-Right, 4 = Up-Down.
 +
5 = In-Out in z, 6 = ULIn-LROut (a diagonal in 3D).
 +
  -s # # #:  size of x,y, and z "radius"  in pixels (4 4 2 default).
 +
  [-e|-d|-o|-c]:      erosion (min), dilation (max), opening (e then d), or
 +
closing (d then e). default is closing.
 +
 
 +
note: entire image name is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
note: the origin of the filter element is at its center.
 +
 
 +
see also: morph  - this is an older, one z-slice at a time version.
 +
 +
</nowiki>
 +
===  multi_gauss_deriv  ===
 +
<nowiki>
 +
 
 +
This program takes an image, blurs it with a Gaussian of
 +
specified standard deviation and then takes derivatives of the image
 +
It does all of this in the frequency domain.  The FFT will be done in parallel
 +
unless the environment variable NPROCS is set to 1.
 +
FFT_MAXMEM variable defines the maximum memory the FFT will use.
 +
outfile is the root name for images and/or pts (-m or -M) files.
 +
 
 +
Usage: multi_gauss_deriv [options] infile.i2i outfile
 +
options:
 +
  -x order:  number of derivatives in the x direction.
 +
default = 0
 +
  -y order:  number of derivatives in the y direction.
 +
default = 0
 +
  -z order:  number of derivatives in the z direction.
 +
default = 0
 +
  -s sigx sigy sigz:  standard deviation in spatial domain of Gaussian.
 +
  -S sigx sigy sigz:  standard deviation in frequency domain of Gaussian.
 +
default = 3.402823E+38  3.402823E+38  3.402823E+38
 +
  -l # res2 res3 ... :  # = number of different resolution levels to calculate.
 +
res2 ... res# are the relative sigmas for each resolution level after
 +
the first one. eg, -l 3 .9 .7  means that 3 blurred levels should
 +
be calculated and the sigma (in the freq domain) of the second
 +
level should be .9 of the first level (ie, more blurred), and the 3rd
 +
level should be .7 of the first level (as specified with -S).
 +
  -L # factor:  # = number of resolution levels. factor is the relative sigmas in
 +
the spatial domain for each level relative to the previous level.
 +
  -e epsilon:  cutoff for Gaussian intensity calculation.
 +
default = 0.040000
 +
  -r: apply scalefactor to output so min= -32766 or max= 32766. This is useful
 +
especially when all the values would otherwise be < 1.
 +
This also prints to stderr the min and max values before rescaling.
 +
  -R #: rescale output by multiplying all values by #.
 +
  -m: calculate coords of 3D maxima after blurring.
 +
  -M: same as -m, but also prevents writing out blurred images.
 +
  -n #: maxima must have an intensity > # (must use -m or -M with this)
 +
  -f #: max pixel must be > all neighbors by at least # to be a maxima. default = 0.000100
 +
note: image dimensions which factor to 2, 3, or 5 go fastest with the FFT.
 +
note: the entire image name is NOT required.
 +
note: compressed images will be uncompressed.
 +
note: a - in place of an image name means stdin or stdout.
 +
see also: max3d, gauss_deriv_unc, blur_spatial, canny, zerosu.
 +
 +
</nowiki>
 +
===  objs_via_ascent  ===
 +
<nowiki>
 +
 
 +
Associates each voxel in inimage.i2i which is > threshold with a 3d maxima in the image.  It finds
 +
the 3d maxima by doing a steepest ascent walk in the image.  Writes info about regions found to
 +
stdout in the same format as countobjs.  Writes an image with each pixel labeled with its region
 +
id to outimage.i2i.
 +
 
 +
Usage:
 +
  objs_via_ascent [options] inimage.i2i outimage.i2i > inimage.count
 +
 
 +
Options:
 +
  -t threshold:any voxel > threshold in inimage.i2i is tracked to a 3d maxima (default = 0.000000).
 +
  -i miniod maxiod : erase all objects whose iod doesn't fall in the specified range
 +
  -s minsize maxsize : erase all objects whose size (in voxels, inclusive) doesn't fall in the specified range
 +
 
 +
Examples:
 +
objs_via_ascent -t 100 in.i2i in_id.i2i > in.count
 +
objs2dist.pl -dz=3 -jack=in_max.rpts -rpts=in_bb.rpts in.count in.count > in.comdist
 +
  (don't really care about comdist here, just want rpts files)
 +
colorize_image -c in_id.i2i in.i2i inr.i2i ing.i2i inb.i2i  (autoscales so max will be 255)
 +
dave -S all 1 0 -nocomp -I ing.i2i -I inr.i2i -Iinb.i2i -n 0 -u in_max.rpts in_bb.rpts
 +
(then turn blue channel on in dave)
 +
 
 +
objs_via_ascent -t 100 in1.i2i in1_id.i2i > in1.count
 +
objs_via_ascent -t 100 in2.i2i in2_id.i2i > in2.count
 +
objs2dist.pl in1.count in2.count > in1and2.comdist
 +
closest_voxel -Q -t 0 0 -p -r 1 -w 1 1 3 in1_id.i2i in2_id.i2i > in1and2.patchdist
 +
/home/lml/krypton/Zhuge/BKandRyr/analysis3/graph.pl -showmatch in1and2.patchdist  > in1and2_match.rpts
 +
 
 +
source code in /home/lml/krypton/facil
 +
see also:
 +
  countobjs countobjsmax3d objs2dist.pl colorize_image closest_voxel ~lml/krypton/Zhuge/BKandRyr/analysis3/run.pl
 +
  channel_current ~lml/krypton/Zhuge/BKandRyr/graph.pl
 +
 +
</nowiki>
 +
===  overlap3  ===
 +
<nowiki>
 +
 
 +
*******  /home/lml/krypton/bin/overlap3
 +
This program calculates the overlap (colocalization)
 +
of two images. It is very similar to the overlap
 +
program, but produces a whole set of numbers with
 +
colocalization for each of many OFFSET DIRECTIONS at which
 +
voxels are considered to be "in the same place"
 +
In other words, suppose
 +
two data voxels are not exactly at the same location in the 2
 +
images, but are offset by 1 voxel in a specific direction. This
 +
program would count that
 +
as an overlap for, say, distance dx = -1, dy = 0, dz = 1.
 +
Output is text written to stdout. The OFFSET displacement is the displacement for
 +
image2. so OFFSET (-1,2,0) means image2 should be translated -1 in x (to the left), +2 in
 +
y (up 2) and not at all in z to align it with image1, e.g.,  tranima -T -1 2 0 image2.i2i image2T.i2i.
 +
 
 +
Usage: overlap3 [options] image1.i2i image2.i2i [maskimage.i2i]
 +
options:
 +
-m maxdist: maximum translational distance that should
 +
be checked (default = 1)
 +
-x maxdist: maximum x translational distance that should
 +
be checked (default = 1)
 +
-y maxdist: maximum y translational distance that should
 +
be checked (default = 1)
 +
-z maxdist: maximum z translational distance that should
 +
be checked (default = 1)
 +
-s step  : step size for translations
 +
(default = 1)
 +
-t thresh1 thresh2: only voxels in image1 > thresh1
 +
and voxels in image2 > thresh2 are
 +
considered for the overlap calculation.
 +
default = 0 and 0.
 +
-l:            keep things less than or equal to the threshold in image1
 +
                (default is greater than the threshold)
 +
-L:            keep things less than or equal to the threshold in image2
 +
                (default is greater than the threshold)
 +
      -v threshold:  all values greater than this value
 +
                    are part of the mask (default 0)
 +
      -V maskvalue:  this value is part of the mask
 +
                    can be used up to 100 times
 +
 
 +
note: entire image name is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
source code in /storage/big1/lml/jac/was_invitro/Projects/overlap3
 +
 +
</nowiki>
 +
===  prune  ===
 +
<nowiki>
 +
 
 +
This program takes an input image and prunes "dangling" paths from
 +
the image.  The input image is assumed to have already been thinned
 +
to a 1 pixel-wide center line using thin3Ds.  The output image can be
 +
converted to a pts file via im2pts.  Which paths get pruned depends upon
 +
the options specified.  By default, every end point is found and the
 +
path from the endpoint to first intersection point is deleted.
 +
The idea behind this program is to get rid of extraneous parts of the
 +
path produced by thin3Ds, to aid visualization.
 +
 
 +
Usage: prune [options] image1.i2i image2.i2i
 +
options:
 +
  -l #: only delete paths which are shorter than # pixels in length.
 +
  -s x y z:  x,y,z coords of a single path to keep.
 +
  -S x y z:  x,y,z coords of other end of the path to keep.
 +
(this should be used with -s).
 +
  -d datafile:  a file with lists of end points (start and stop) of
 +
paths to keep. Each line has a start and stop pt: (x1,y1,z1) (x2,y2,z2)
 +
  -X lx hix:    keep all paths whose endpts are within this x range (inclusive)
 +
If you specify any of X,Y,or Z, you must specify all 3.
 +
  -Y ly hiy:    keep all paths whose endpts are within this y range
 +
  -Z lz hiz:    keep all paths whose endpts are within this z range
 +
these 3 options are ANDed together.
 +
 
 +
note: all coords are zero indexed (ie, first pixel is numbered 0, not 1)
 +
note: entire image name (with extension) is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
note: a compressed image will be automatically be uncompressed.
 +
/home/lml/krypton/bin/prune
 +
 
 +
</nowiki>
 +
===  shrink_wrap  ===
 +
<nowiki>
 +
/home/lml/krypton/bin/shrink_wrap
 +
 
 +
Usage:
 +
 
 +
shrink_wrap -R input.rpts input_image output_root [options]
 +
 
 +
input_image  Image file for blurring - WITHOUT the .i2i ending
 +
output_root  Root name of output file (no .tail ending). will produce output_root.rpts
 +
 
 +
Options:
 +
 
 +
-B  use sphere as initial surface (default cylinder)
 +
-P name of file contaning point spread function
 +
    By default is a gausian psf
 +
-r set blur3d to write output image as real
 +
-R name of file containing rpts file
 +
    Must be used in the command line 
 +
-M name of file containing mesh
 +
-U file:  file is a pre-blurred attractant image in i2i image format
 +
so input_image is not used for anything except
 +
for image dimensions. see OUTPUT below.
 +
-S Value for scaling blurred image
 +
    By default equals 1.0
 +
-o value of overlapping in pixels along X and Y axes
 +
    By default equals 10.             
 +
-p value of zero padding in pixels along X and Y axes
 +
    By default equals 10.             
 +
-z value of zero padding in pixels along Z
 +
    By default equals 10.             
 +
-a memory allocation coefficient
 +
    By default equals             
 +
-w  # # # # # #:  Weights for Su Sv Suu Suv Svv E
 +
    u are pts in the plane and v are points in z or time
 +
    By default .4 .4 .2 .2 .2 -1.0
 +
-W # # #  Weights for x y z
 +
    By default 1.0 1.0 1.0
 +
-D  for two dimentional images in a time series
 +
-d #  dilate rpts file slices by #
 +
    By default 0
 +
-F do not allow slices from rpts file to move
 +
    NOTE: These points will NOT change in the shrink wrap
 +
    NOTE: They will not be dilated or moved in min_cylinder
 +
-v: verbose
 +
-I #: save vertex files and (if SAVE_ENERGY defined in min_cylinder)
 +
    files of the energy of the vertices every # iterations.
 +
      These can be read in and displayed by ~jac/bin/wire
 +
 
 +
ACTIONS:
 +
shrink_wrap takes a mesh of points and fits it to some
 +
surface.  To initialize the mesh, use planimeter to outline
 +
the cell in a few key z slices, include at least the first and
 +
last z slices, as well as any key features (bulges, bends, etc).
 +
To create an attractant function, a default Gaussian psf is used.
 +
This psf is located at /storage/big1/lml/Linux/bin/psf8.i2i.
 +
If this is compressed, make a copy in your favorite dir, uncompress
 +
and tell shrink_wrap where it is whith the -P option.
 +
 
 +
NOTES:
 +
Input:  this shell script expects the length of the cell to be
 +
        in the Y direction.  An rpts file should be created from a copy
 +
        of the image created with transp -YZ file.i2i file_T.i2i.
 +
        (where file.i2i is your image file, and file_T.i2i is your
 +
        image file transposed in Y and Z).
 +
Output: three intermediate files will be created (and deleted), one called output_root.i2i
 +
        which contains the coordinates of the final deformed mesh,
 +
        output.rpts which will contain an rpts file with a surface
 +
        drawn from output.i2i, and output__root_B.i2i which is the blurred input image
 +
source code is in /storage/big1/lml/jac/was_invitro/Projects/shrink_wrap
 +
 
 +
EXAMPLE:
 +
    suppose you have a cell cell.i2i that has its length in the Y direction.
 +
    and you want to save the cell output as cell_YZ_shrink.rpts:
 +
transp -YZ cell.i2i cell_YZ.i2i
 +
planimeter3 -I cell_YZ.i2i -R cell_YZ.rpts
 +
shrink_wrap -R cell_YZ.rpts cell cell_YZ_shrink >& cell.log
 +
  cell_YZ_shrink.rpts will be created (along with intermediate files cell_YZ_shrink* which get deleted).
 +
  The messages which result will be located in cell.log
 +
dave -I cell.i2i -T 1 YZ cell_YZ.rpts cell_YZ_shrink.rpts
 +
  (due to a bug you may have to zoom out of the image a bit for the rpts data to show up on dave)
 +
addlines cell_YZ.i2i cell_YZ_shrink.rpts - | play -P -1 R -
 +
 
 +
SEE ALSO:  Corecell.pl (to apply after shrink_wrap)
 +
 
 +
 
 +
Correct Orientation of the cell
 +
______________________________      _____________________________
 +
|    .                .      |    |    . . ......            |
 +
|  .                  .      |    |    .          . .        |
 +
|  .                  .    |    |  .              .      |
 +
|  .                  .    |    |  .                  .    |
 +
|  .                  .      |    |    .                  .  |
 +
|  .                  .    |    |    . .                .  |
 +
|  .                  .      |    |      .              .    |
 +
|  .                  .    |    |      .            .    |
 +
|    .                  .    |    |        ............      |
 +
|_____________________________|    |___________________________|
 +
length of cell in Y direction      cell after transp -YZ
 +
correct orientation for input      correct orientation for drawing
 +
file                                outlines with planimeter
 +
 
 +
main_memory: Command not found.
 +
Eval: Command not found.
 +
 
 +
</nowiki>
 +
===  snakeTrack  ===
 +
<nowiki>
 +
 
 +
Tracking a 2D time series using snakes.
 +
The program takes as input an image (a 2D timeseries)
 +
and a starting contour for the first slice of the image
 +
in .rpts or .con format.
 +
The program will attempt to track the moving contour
 +
from one slice to the next.
 +
 
 +
It does this by mimimizing
 +
F = I - E where I is the internal energy of the snake and
 +
E is the external energy as represented by the input image
 +
The internal energy is defined as the similarity to the original
 +
shape of the starting contour.  If a con file is specified as
 +
input (instead of rpts file) it is recognized as such automatically
 +
by the magic number at its top (see ~dal/synapse/projects/snakeTrack for an example).
 +
Con files are 5-tuples: x y alpha beta lambda where alpha and
 +
beta are shape descriptors (which can be generated automatically
 +
by rpts2con).  Lambda is a weight on the local internal energy of deformation
 +
and 1-lambda is the weight on the local external energy.
 +
 
 +
The program will produce as output a
 +
.rpts file, which will contain an object for each slice.
 +
The objects can then be superimposed on the original image
 +<