Difference between revisions of "Software2"

From Wiki
Jump to navigation Jump to search
 
(8 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.
 
                    The file is a list of numbers (current or scale), 1 per line, at dt (in sec) intervals.
 
                    If op = T, currents greater than the specified threshold means channel open, otherwise closed.
 
                    If op = S, the current as specified with -ion_src is scaled by the number in the list.
 
                    "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:
+
  miscellaneous:
    -save name filename type scale dt:
+
  -v: verbose. produces list of each Ryr cluster and K current produced to stderr. Other stuff too.
                    Save images of the specified substance (name) to specified file. By default
+
To write this to a separate file do: (channel_current -v ... > stdout.channel) >& stderr.channel
                    substances are saved in mM.  This will be multiplied by the scale
+
  -V: very verbose
                    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):
+
Examples:
    invoke on the wolves as, for example,  mpirun -np 3 -machinefile file_of_machine_names cellsim ...
 
    -print_proc #:  only print output from the specified process (0 indexed).
 
                  Some output (eg, Total mmoles of ions, etc) are only valid for process 0.
 
    -overlap #:  overlap neighboring regions by the specified number of voxels (default = 50)
 
                  This will also be the number of iterations between necessary synchronization.
 
    -debug_mpi #:  print MPI info. Execute MPI dummy stubs if MPI NOT present (eg, under Windows,SGI).
 
                  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!
 
  
EXAMPLES
+
cellsim -spacing /home/lml/krypton/Zhuge/STIC/simulations/spacing2.txt ....     : produces ca.i2i
./cellsim -time .0010 -time_rate .5 -length 200 -rings 40 -radius 1 \
+
printvalsL -spacing2.txt -R -t -i ca.i2i > ca.vals    
        -ion Ca 100E-6 2.5E-6 2 -buffer Fluo3 .050 2.5E-7 -buffer Buf .230 1E-14  \
+
kate ca.vals     : delete fist comment line
        -kin Fluo3 Ca CaFl 8E4 90 2.5E-7 -kin Buf Ca CaBuf 1E5 100 1E-14       \
+
       objs_via_ascent -s 5 100 Ryr.i2i Ryrid.i2i > tmp
        -ion_src Ca 1 .00105 99 102 0 3 \
+
tail tmp  : the mean IOD gives an idea of brightness needed to produce current used in cellsim, say 30000
        -save all _run1 I 1 .0001 >& cellsim_run1.out
+
      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
  
 +
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:
  
Simulate for 100msec saving images every msec. 1 pA comes in the the pattern as specified
+
Source code in ~krypton/lml/facil 
by psf_float.i2i for 10 msec. The current is then modulated by values in current.txt which
+
  # Popen is monotonic as it should be.
are one value per line, dt of 1 msec between them. Cell shape in mask.i2i. Voxel sizes in
+
must provide -f cafilename
spacing.txt
 
./cellsim -time .100 -time_rate .5 -spacing spacing.txt -mask mask.i2i \
 
        -ion Ca 100E-6 2.5E-6 2 -buffer Fluo3 .050 2.5E-7 -buffer Buf .230 1E-14  \
 
        -kin Fluo3 Ca CaFl 8E4 90 2.5E-7 -kin Buf Ca CaBuf 1E5 100 1E-14        \
 
        -ion_src_file Ca psf_float.i2i 1 .010 \
 
        -ion_current_trace Ca current.txt .001 S 999 \
 
        -save CaFl cafl.i2i I 1000 .001 -save Ca ca.i2i I 1E6 .001 \
 
        -save_flow Ca ca_radial_float.i2i ca_long_float.i2i 1 .001 >& cellsim.out
 
  
SEE ALSO
+
</nowiki>
      ~lml/vision/bin/float2int                    (convert a floating point image to standard SHORT INT format)
+
===  cluster  ===
      ~lml/vision/bin/int2float       (convert normal image to floating point)
+
<nowiki>
      ~lml/vision/bin/playexact                    (to display a floating point image)
+
Drops random Ryr receptors into a world.  Then calculates how many clusters and their sizes get produced.
      ~lml/invitro/Kargacin/changeheader          (change header of floating point image)
+
Currently the "world" default size is  (2um)^3.  (see -wsize)
      ~lml/vision/bin/cyl2cart                    (convert from cylindrical to cartesian coords)
+
The origin of this world is in it's center (so it goes from -1um to +1 um in each direction by default).
      ~lml/vision/bin/nadiffl7                    (many more options, but only 1 ion and 2 buffers)
+
A histogram of cluster sizes is printed to stdout.
      ~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  ===
+
Usage:
channel_current2: like channel_current, but looks at [ca] over time at each BK (not just max [ca]).
+
cluster [options]  
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
 
activates nearby BK channels in BK_image.i2i. Produces a histogram of these output currents.
 
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:  a one pixel border around the image is ignored (added 12/8/09).
 
This may take about one-half hour to run.
 
 
 
Usage:
 
channel_current [options] -f filename Ryr_image.i2i BK_image.i2i > im1_im2.hist
 
 
Options:
 
Options:
-f filename resting: file containing [ca], in nM, as a function of distance and time. Right now this is
+
distance options:
assumed to have 20 nm spacing and entries every msec. See
+
-eucliddist:     calculate a Euclidean distance (same in x,y,z directions). This is the default.
/home/lml/krypton/Zhuge/STIC/simulations/run32.ca as an example
+
  (use -cdist option to set the nearby distance for this).
"resting" is the resting [ca], in nM, for the cell. It will we subtracted from the other
+
-absdist:   rather than calculate a real distance, calculate max(ABS(dx),ABS(dy),ABS(dz)) - for speed
[ca] values to produce a "delta" [ca] which gets scaled linearly by Ryr intensity.
+
  (use -cdist to set the nearby distance for this.)
The spark current used to produce this (see -C) should be roughly in the range expected
+
-psfdist x y z:  distance (in um) a pt can be in the x, y, and z directions and be considered nearby.
for Ryr_image.i2i, since all delta [ca] is linearly extrapolated.
+
  Does not use -cdist.  To approximate a psf you might specify .2 .2 .6
All distances > largest distance in filename will have their [ca] set to the [ca]
+
      -cdist #:        how close (in um) two receptors must be to cluster, default = 0.500000
at the largest distance in filename.
+
other options:
note: Only the [ca] values at y == 1 are used. Is this what should be used?
+
      -2D:   do a 2D simulation (x and y), not a 3D simulation
-u #: voltage (mV). BK conductance is a function of voltage. default = -80.000000
+
-cylinder inner outer:  only place Ryr within a cylinder (e.g., plasma membrane) with specified
-U low delta hi: voltages from low to hi by delta. Max is 20 voltages
+
                        inner and outer radius (in um). The cylinder has its length the entire y dimension.
-r #:         resolution (binsize) for output histogram in femtoAmps, default = 1000.000000
+
  Only the parts of the cylinder which fit in the world (-wsize) are used.
-R #: reveral potential of BK channel in mV, default = -80.000000
+
-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
  
  distances:
+
Examples:
-w # # #: x,y, zweights for pixel distances (ie, pixel size), default = 1 for each.
 
-p #: pixel size in nm (i.e., what 1 means in -w option), default = 80.000000
 
-m # :         maxdistance (in units used for -w, i.e., pixels) to look for the closest pixel, default = 10.000000
 
  
  which pixels or clusters to include:
+
Source code in ~krypton/lml/Zhuge/Ryr_clusters 
-t # #: image1 and image2 thresholds, pixels > # are above threshold, default = 0.
+
  /home/lml/krypton/bin/cluster -h
-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 Ryr_image.i2i within the size range (inclusive, in voxels)
 
max size allowed = 100000
 
-S minsize maxsize:    only look at objects in BK_image.i2i within the size range (inclusive, in voxels)
 
-i miniod maxiod:    only look at objects in Ryr_image.i2i within the iod range (inclusive. use -d also.)
 
-I miniod maxiod:    only look at objects in BK_image.i2i within the iod range (inclusive. use -D also.)
 
  
  scale factors:
+
</nowiki>
-d Ryrimage1d.i2i #: the original intensity image for Ryr_image (since Ryr_image has pixel values as id numbers)
+
=== diffusion_limited_binding  ===
# is the number of Ryrimage1d.i2i intensity units required to produce spark current
+
<nowiki>
used in the calcium simulation (which produced the -f filename data).
+
unknown option h
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:
+
Prints out distance (um) and concentration (particles/cm^3) at that distance
  -v: verbose. produces list of each Ryr cluster and K current produced to stderr. Other stuff too.
+
a slab volume of initial uniform concentration (1 particle/cm^3)which has a ligand
To write this to a separate file do: (channel_current -v ... > stdout.channel) >& stderr.channel
+
binding to a plane at x = 0. This is diffusion limited binding. See my notes of 10/20/98.
  -V: very verbose
 
  
Examples:
+
Usage: diffusion_limited_binding [options] 
 +
options:
 +
  -D #:  diffusion (cm^2/msec), default = 2.2E-09
 +
  -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.
 +
  -x x1 x2: start and stop distances to print (um), default = 0.000000 10.000000
 +
set both number equal if you only want one position
 +
  -L #: thickness of slab volume (um), default = 10.000000
 +
  -T #: number of samples in t, default = 10
 +
  -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)
 +
 +
</nowiki>
 +
===  ellipse  ===
 +
<nowiki>
  
cellsim -spacing /home/lml/krypton/Zhuge/STIC/simulations/spacing2.txt ....     : produces ca.i2i
+
This program creates an elliptical cell, cell length is in the y direction.
printvalsL -spacing2.txt -R -t -i ca.i2i > ca.vals    
+
It is used to model a squashed cell, and see how different it looks after
kate ca.vals     : delete fist comment line
+
blurring than a cylindrical cell
      objs_via_ascent -s 5 100 Ryr.i2i Ryrid.i2i > tmp
 
tail tmp  : the mean IOD gives an idea of brightness needed to produce current used in cellsim, say 30000
 
      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
 
  
channel_current -f ca.vals -w 1 1 3 -d Ryr.i2i 30000 -D BK.i2i 1000 Ryrid.i2i Bkid.i2i > ryr_bk.info
+
Usage: ellipse [options] ellipse.i2i
cull -s -c -1 -4 < ryr_bk.info |xmgrace -source stdin
+
options:
See also:
+
  -d xdim ydim zdim:  dimensions of image, default = (50,100,50)
closest_object closest_voxel objs_via_ascent /home/lml/krypton/Zhuge/BKandRyr/graph.pl,match.pl
+
  -r xradius zradius:  radius (in pixels) in the x and z directions, default (20.000000,20.000000)
graph_channel_current.pl, test_channel_current, /home/lml/krypton/Zhuge/STIC/simulations/run32  
+
  -s samplerate:  number of subsamples in x and z directions per pixel, default = 1
/home/lml/krypton/Zhuge/BKandRyr/analysis6/cluster_distances.pl, plot_mean_sd_curve.pl
+
  -i intensity:  intensity inside the ellipse, default = 100.000000
/home/lml/krypton/Zhuge/xpp/ASM15.ode
+
Bugs:
+
</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.
  
Source code in ~krypton/lml/facil
+
Usage: em [options]
  # Popen is monotonic as it should be.
+
options:
must provide -f cafilename
+
  -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 #)
===  cluster  -h ===
+
                        order: T[1][1], T[1][2], ... T[1][S], T[2][1] ... T[S][S] if there are S states),
Drops random Ryr receptors into a worldThen calculates how many clusters and their sizes get produced.
+
                        where T[i][j] is the probability of a transition from state i to state j.
Currently the "world" default size is  (2um)^3. (see -wsize)
+
  -p # # # ... #: prior probabilities of states (S entries if there are S states)
The origin of this world is in it's center (so it goes from -1um to +1 um in each direction by default).
+
  -P #: which prior estimate to use for the pdf of the data (ie., estimate of Poisson process)
A histogram of cluster sizes is printed to stdout.
+
        1 = uniform, 2 = delta, 3 = uniform+delta, 4 = peice of observed data histogram (default)
 
+
        5 = true pdf (Poisson)
Usage:
+
  -n #: number of data points to simulate, default = 100
cluster [options]  
+
  -m #: maximum number of iterations to perform, default = 20
Options:
+
        -truetrans: use the true transition probabilities as the initial guess (default = uniform)
distance options:
+
        -trueprior: use the true prior probabilities as the initial prior guess (default = uniform)
-eucliddist:     calculate a Euclidean distance (same in x,y,z directions). This is the default.
+
  -findstates:  also find (and print) the estimate of the states at each time point.
  (use -cdist option to set the nearby distance for this).
+
  -v:  verbose. print more info to stderr.
-absdist:   rather than calculate a real distance, calculate max(ABS(dx),ABS(dy),ABS(dz)) - for speed
+
  -V:  print some more info. Some printouts only occur if # data pts is < 1000
  (use -cdist to set the nearby distance for this.)
+
 
-psfdist x y z:   distance (in um) a pt can be in the x, y, and z directions and be considered nearby.
+
Source code in /home/lml/krypton/facil/em.cc
  Does not use -cdistTo approximate a psf you might specify .2 .2 .6
+
See also: ~/krypton/facil/transpose.pl  to print out selected lines from the output file
      -cdist #:         how close (in um) two receptors must be to cluster, default = 0.500000
+
          ~/krypton/matlab/netlab: has EM routines
other options:
+
          ~/krypton/matlab/bayes/BNT/HMM: has HMM and EM routines
      -2D:   do a 2D simulation (x and y), not a 3D simulation
+
/home/lml/krypton/bin/em -h
-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.
+
</nowiki>
  Only the parts of the cylinder which fit in the world (-wsize) are used.
+
===  makebeads2 ===
-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)
+
<nowiki>
-psize x y z:   pixel width (in um) in the x, y, and z directions (default = 0.1,0.1,0.1)
+
/home/lml/krypton/bin/makebeads2
      -numryr #:       number of Ryr receptors to drop, default = 1000
+
 
-mindist #:   when placing Ryr receptors, keep this minimum distance (in um) between them.
+
randomly distributes beads within a volumecreated to let Jack simulate
-randstart #:   start the random number generator with # as the seed. So runs can be reproduced.
+
distribution of glut4 labels vesicles in the TIRF field of a microscope.
-image name.i2i   write out an image of the Ryr receptors. Can then use blur3d to create a realistic
+
A bead has a constant value between its inner and outer diameters. This value
  microscope image, and countobjs to analyze it and compare to real data.
+
falls to zero 3 standard deviations inside the inner diameter and 3 sd outside
diagnostics:
+
the outer diameter. Beads are not allowed to intersect each other.
      -debug:           turn on debugging
+
Writes info about beads created or moved to stdout (can be read back in with -b option).
      -verbose:        be a bit more verbose
+
note: coords written out are zero indexed (not 1-indexed like addlines and play) in pixels.
      -h:  print this help
+
usage:
      -H:   print this help
+
makebeads2 [options] outimage.i2i
      -help:  print this help
+
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 appropriatenote: 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 maxallowed 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 maxallowed 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
  
 
Examples:
 
Examples:
 +
#create 200 beads, with a 50 nm (5 z plane) gap before the pm, which has an
 +
#intensity of 50. Apply a TIRF exponential excitation scale to it.
 +
makebeads2 -e .1 -z 5 63 -p 5 50 -n 200 beads1.i2i > beads1.info
 +
# apply microscope psf
 +
blur3d -P -N 256 256 128 beads1.i2i empiricalpsf_seg_40nm_seg.i2i beads1_blur3d.i2i
 +
# bin (averge) to 100/160 nm resolution
 +
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
 +
 +
#creates beads, move them, look at the results
 +
makebeads2 -z 5 63 beads1.i2i > beads1.info
 +
#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
 +
 +
#just create scripts (very fast) with positions of beads, and move them around.
 +
makebeads -z 5 63 -n 200 -A dummy.i2i > beads1.info
 +
makebeads -b beads1.info .05 .05 -z 5 63 -A dummy.i2i > beads2.info
 +
makebeads -b beads2.info .05 .05 -z 5 63 -A dummy.i2i > beads3.info
 +
#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
 +
 +
see also:  makebead, readbeads.pl, blur3d, project, /storage/big1/sh/simul
 +
 +
source code in ~lml/krypton/facil
 +
 +
</nowiki>
 +
===  oxygen  ===
 +
<nowiki>
 +
Calculates steady state partial oxygen pressure (P) as a function of distance from a blood vessel (r).
 +
The blood vessel has a radius of R1 (5.0 um) and Oxygen at the vessel is Ps (52.0 mm Hg).
 +
The default is to print partial Oxygen pressure (mm Hg) as a function of distance (um) as columns to stdout.
 +
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).
  
Source code in ~krypton/lml/Zhuge/Ryr_clusters  
+
The line source model (-m 1) implements equation 17 from KroghOxygenDiffusionModel1.pdf
/home/lml/krypton/bin/cluster -h
+
  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.
  
===  diffusion_limited_binding  -h  ===
+
The point source model (-m 2) implements equation 14 from HeatConduction.pdf
unknown option h
+
  Steady Heat Conduction in Layered Mediums: The Half-Space and Sphere, by Henry N. Pollack
incorrect command line.
+
  J. of Geophysical Research, vol. 70(22), Nov. 15, 1965, pp. 5645-5648
Prints out distance (um) and concentration (particles/cm^3) at that distance
+
This models O2 assuming a constant oxygen consumption by the tissue and constant O2 (Ps) at the blood vessel.
a slab volume of initial uniform concentration (1 particle/cm^3)which has a ligand
+
note: The value of dP/dr at R2 is forced to 0 unless -b # is specified.
binding to a plane at x = 0. This is diffusion limited binding. See my notes of 10/20/98.
+
note: Since O2 consumption is constant, it might not make sense to use this in a convolution, since it isn't
 +
      linear.
  
Usage: diffusion_limited_binding [options] 
+
Model 3 is a point source model, but O2 consumption by the tissue is proportional to the O2 level in the tissue.
options:
+
  I derived it from Crank's equations 6.60 (infinite hollow sphere model) and 14.13 (see below).
  -D #:  diffusion (cm^2/msec), default = 2.2E-09
+
  It requires the specification of an initial O2 level in the tissue (P0, which is the same everywhere).
  -t t1 t2:  start and stop time to simulate (msec), default = 0.000000 1000.000000
+
  R2 is used only to determine how far out to plot the graph (and dP/dr at R2 is not used either).
set both numbers equal if you only want one time point.
+
  See my paper notes or ~/krypton/Corvera/Olga/SteadyStatePointDiffusion.pdf
  -x x1 x2: start and stop distances to print (um), default = 0.000000 10.000000
+
  Not only is proportional O2 consumption more biological, but I think this should be linear and therefore
set both number equal if you only want one position
+
  it makes more sense to use in a convolution with a (binarized?) blood vessel image.
  -L #: thickness of slab volume (um), default = 10.000000
+
 
  -T #: number of samples in t, default = 10
+
note: because R2 really should vary in an image, depending upon the distance between nearby blood vessels
  -X #: number of samples in x, default = 1000
+
        and because Ps is not just a scale factor (so, eg, brighter blood vessels in an image, if brightness is
  -h: print this help message.
+
        proportional to Ps, do NOT just cause a scale factor in the P(r) values), it may NOT be appropriate
  -F: print out time (msec) and flux (particles/cm^2-msec) at x = 0
+
to take the image produced by this program and convolve it with an image of blood vessels to get
(i.e., rate molecules binding to x=0 surface).
+
estimates of oxygenation of tissue. This comment may apply to all three models (definitely to -m 1)
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
+
Usage: oxygen -m # [options]  
(i.e., brightness of surface). Integral of flux from t1 = 0 regardless of -t option setting.
+
    required:
  -s: don't print out concentration as a function of x (i.e, the entire slab)
+
  -m # which model to use.
   
+
        -m 1 :line source model with constant O2 consumption
===  ellipse  ===
+
-m 2: point source model with constant O2 consumption.
incorrect command line.
+
        -m 3 :point source model with O2 consumption proportional to O2 concentration.
This program creates an elliptical cell, cell length is in the y direction.
+
Use point source models if planning on convolving resulting image with a blood vessel image.
It is used to model a squashed cell, and see how different it looks after
 
blurring than a cylindrical cell
 
  
Usage: ellipse [options] ellipse.i2i
+
    options for all models:
options:
+
Although these options can be used in all models, different models have different sensitivities to them.
  -d xdim ydim zdim:  dimensions of image, default = (50,100,50)
+
  -R1 # vessel radius (um). Changes to this can change P a lot (if -m 1), and may require R2 to change (see -c).
  -r xradius zradius:  radius (in pixels) in the x and z directions, default (20.000000,20.000000)
+
default = 5.00
  -s samplerate:  number of subsamples in x and z directions per pixel, default = 1
+
  -R2 # max distance any tissue is from a vessel (um). This changes the solution a lot for some models
  -i intensity:  intensity inside the ellipse, default = 100.000000
+
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).
===  em  -h  ===
+
  -Ps # partial pressure of Oxygen at the blood vessel (mm Hg). Default = 52.00
Creates (or reads in) a HMM and then generates random data from it
+
40 is typical of veins, 95 of arteries. This is held constant over time in all the models right now.
(each model is a poisson process, with the j_th model having a lambda = 10*j).
+
For -m 1, this will affect the O2 value at R1, but how P changes RELATIVE to P(at R1) (as r increases)
Then attempts to use an EM algorithm to estimate the original model.
+
will not be affected (ie, it does NOT just scale everything).
This is a way for me to learn how to implement the EM algorithm.
+
    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)
  
Usage: em [options]
+
    output graph options:
options:
+
  -n normalize output (doesn't affect -i image.i2i), ie, print r/R1  vs P/Ps  rather than r vs. P
  -s #: number of states, default = 2. Must specify -t and -p after this.
+
  -r add a third reference column which is the "simple" diffusion solution (goes as 1/r)
  -t # # # ... #: state transition probabilities. If there are S states (e.g., -s #)
+
This is for a point source in 3D (not a line source), and ignores O2 consumption.
                        order: T[1][1], T[1][2], ... T[1][S], T[2][1] ... T[S][S] if there are S states),
+
graph as: oxygen_krogh -r | xmgr -nxy stdin
                        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)
+
    output image options:
  -P #: which prior estimate to use for the pdf of the data (ie., estimate of Poisson process)
+
  -i image.i2i xdim ydim zdim: create an image of the values, to use with blur3d to find
        1 = uniform, 2 = delta, 3 = uniform+delta, 4 = peice of observed data histogram (default)
+
O2 everywhere in an image as a function of distance from blood vessels.
        5 = true pdf (Poisson)
+
If you are planning on convolving you should probably specify -m 3 .
  -n #: number of data points to simulate, default = 100
+
  -d x y z if -i is specified. pixel dimensions in um. default = 0.60 0.60 10.00
  -m #: maximum number of iterations to perform, default = 20
+
  -s # if -i is specified. scale output intensities by #. Otherwise max is 52.0 mm Hg
        -truetrans: use the true transition probabilities as the initial guess (default = uniform)
+
  -o xorig yorig zorig: location of the blood vessel in the image (zero indexed, floating point)
        -trueprior: use the true prior probabilities as the initial prior guess (default = uniform)
+
blur3d may care about this, depending upon options. default = (0.00,0.00,0.00)
  -findstates:  also find (and print) the estimate of the states at each time point.
+
(maybe I should change this to define a line in the image when -m 1 is specified?)
  -v:  verbose. print more info to stderr.
+
-p the output image should be for the simple 1/r point source (see -r explanation) rather
  -V:  print some more info. Some printouts only occur if # data pts is < 1000
+
for the line source (-m 1) or point source with O2 consumption (-m 2 or -m 3).
  
Source code in /home/lml/krypton/facil/em.cc
+
    other options:
See also:  ~/krypton/facil/transpose.pl  to print out selected lines from the output file
+
  -v verbose. stuff to stderr.
          ~/krypton/matlab/netlab: has EM routines
+
  -V more verbose. stuff to stderr. debugging info.
          ~/krypton/matlab/bayes/BNT/HMM: has HMM and EM routines
+
  -h print this help
/home/lml/krypton/bin/em -h  
 
  
== Statistics ==
+
Examples:
===  cluster_distances.pl  -h  ===
+
      # 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
  
  Takes output from channel_current2 (after 11/24/09) and pulls out statistics about
+
see also: /home/lml/krypton/Corvera/Olga/README, SteadyStatePointDiffusion.pdf (my notes)
  mean distance to each BK clusterThen produces average stats from all the files
+
        Random Walks in Biology (New, expanded edition) by Berg p. 23 eq. 2.11;
  analyzed. Output to stdout.
+
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.
  
  
  usage:
+
</nowiki>
 +
=== sparkspread  ===
 +
<nowiki>
  
  -files:file1:file2:...:filen       which files to analyze. Defaults are files named 2_*.currents in cwd.
+
Calculates the spread of spark event amplitudes given that two events occur at the same
  -numBKvsProb       also prints numBK vs prob data suitable for xmgrace
+
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.
  
example:
+
Usage: sparkspread [options] datafile
  (channel_current2  .... > file.channel_current) >& file1.currents
+
options:
  (channel_current2 .... > file2.channel_current) >& file2.currents
+
  -h: do NOT print histogram for intraspark data.
  cluster_distances.pl -numBKvsProb -files=file1.currents:file2.currents > avg_distances.txt
+
  -H: do NOT print histogram for interspark data.
  fgrep -v clusters avg_distances.txt |xmgrace -pipe
+
  -c: do NOT print cumulative distribution for intraspark data.
 +
  -C: do NOT print cumulative distribution for interspark data.
 +
  -b #: number of bins for histogram, default = 20
 +
  -n: normalize the histograms so their maximum is 1
 +
  -k: also print ks statistic showing if two distributions are different.
 +
   
 +
</nowiki>
 +
===  spot_diffusion  ===
 +
<nowiki>
 +
unknown option h
  
note: mean distances to clusters are not always increasing (e.g., mean distance to 10th
+
Prints out time (secs) and concentration (nMolar) seen at a distance
      cluster could be SMALLER than the mean distance to the 9th cluster).  I think this
+
from a channel with a constant current, open for specified time.
      has to do with limiting my maximum distance (see comments in this file).
 
  
 +
Usage: spot_diffusion [options] 
 +
options:
 +
  -D #:  diffusion (cm^2/sec), default = 2.2E-06
 +
  -c #:  current (pAmp), default = 1
 +
  -s #:  starting concentration (resting level, in nM), default = 0
 +
  -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
 
   
 
   
  see also:
+
</nowiki>
  channel_current2
+
===  total_ca ===
  /home/lml/krypton/Zhuge/BKandRyr/analysis6/run12
+
<nowiki>
  /home/lml/krypton/Huang/Kth_pt.m
+
#/home/lml/krypton/bin/total_ca
  p. 637 of Cressie.
 
  
+
Reads in a floating point image or short int image as produced by simulation (i.e., cylindrical coords), calculates
===  coloc.pl  -h  ===
+
the total calcium change (i.e., [ca](r)*pi*r*r - t(0)) as a function of distance from the calcium entry site.
 +
Output is printed to stdout.
 +
All input concentrations should be in nM
 +
Each z slice is analyzed separately (i.e., z is assumed to be time) unless image is rectangular and 3D (-R).
  
calls coloc3way with a bunch of different thresholds. Creates an output file which can be
+
Usage: total_ca [options] ca.i2i
graphed with VennDiagram.m.  
+
      options for printing graphs of calcium (not concentration) vs. distance from ca entry location:
 +
the units for the graph are nM*um^3, but 1nM = .6ions/um^3 , so multiply be .6 to get ions
 +
                      (and 1pA = 3,000 ions/msec if you want to convert to pA-msec).
 +
        -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).
  
coloc.pl im1.i2i im2.i2i im3.i2i  > out.coloc3way
+
  -p # #: pixel size in microns in the radial (x) and lengthwise (y) directions,
 +
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.
  
options:
+
see also:
-time_vs_thresh just generate a file which shows which times correspond to which thresholds. images can be dummy names.
+
    printvals, float2int, in matlab: readxmgr, acurves (see ~lml/krypton/JSinger for an example)
  
-t1=#:#:# threshold one should go from # to # by #. default = 800:1200:50
+
source code in ~lml/krypton/Walsh directory.
-t2=#:#:# threshold two should go from # to # by #. default = 800:1200:50
+
-t3=#:#:# threshold three should go from # to # by #. default = 2000:4000:200
+
</nowiki>
-numthresh=#1:#2:#3  ignore the third number in the -t1, -t2, and -t3 options (or in the default) and instead calculate a
+
=== vcspat-models  ===
  threshold step size so that #1 thresholds are applied to im1.i2i (dat image)
+
<nowiki>
  #2 thresholds are applied to im2.i2i (ctx image), #3 thresholds are applied to im3.i2i (rin image).
+
argc = 1
  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
+
This program creates a volume image with objects randomly placed
Dr. Melikian is interested in. Graph via xmgr -nxy. See header in file for coloc info.
+
within itThe mask image defines where an object is allowed to be placed.
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)
+
The mask value can be changed with the -M optionObjects can either be individual
-Melikian2=file Same as -Melikian, but dat (488) is image 1, ctx (594) image 2, and rin (405) image 3
+
voxels (the default) or tiny images (-o option) or connected voxels in an image (-O).
-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
+
Usage:
-verbose
+
  vcspat-models [options] mask.i2i out.i2i
  
example:
+
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
  
coloc.pl im1.i2i im2.i2i im3.i2i > coloc.data
+
Options related to objects:
coloc.pl -time_vs_thresh im1.i2i im2.i2i im3.i2i > coloc.times
+
  -O thresh name.i2i: threshold an image to use for objects. Extracts as an object each
matlab
+
            connected set of voxels above threshold.  Places these  objects randomly
>> VennDiagram('coloc.data','percent'# and manually look at coloc.times while doing this to convert times to thresholds.
+
            into the output image (uses each object once). Use with the
 +
            -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).
 +
 
 +
OtherOptions
 +
  -s #    : seed for random number generator (default pid)
 +
  -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.
 +
note: a - in place of an image name means stdin or stdout.
 +
Examples:
 +
  objs_via_ascent in1.i2i inid1.i2i
 +
  objs_via_ascent in2.i2i inid2.i2i
 +
  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
 +
 
 +
Source code in /storage/big1/lml/jac/was_invitro/Projects/cspat-volume
 +
 
 +
</nowiki>
 +
== Image Analysis ==
 +
===  Corecell.pl  ===
 +
<nowiki>
  
see also:
+
Takes a 3d image and an outline and keeps all data pts within the specified distance
~/krypton/packages/fiji/Fiji.app/plugins/jacob_.jar  - more traditional colocalization measures
+
of the outline (removes the "core" of the cell). 
coloc_tseries2
+
Also produces a file named in_image_H.histo. See help for histogram2 about that.
colocalizeL
+
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).
  
+
Written to let Ronghua only keep BK and Ryanodine label near the plasma membrane.
===  probcircle.pl  -h  ===
+
Note: touching voxels may have a distance of .5 voxels, and voxels at the same
  given a sphere of diameter D, what is the prob of oberving a disk of radius r when a random plane intersects it?
+
      position may have a distance of -.5 (??)
  prints to stdout: r  prob(r) 1/prob(r)
+
Note: pixels may be kept near the end of the cell, since they have close distance to the end
 +
      (rather than to the plasma membrane. Might -Z # # option to histogram2 fix this?).
 +
Note: there might be problems if boundary.pts touches the edge of the image.
  
  usage:
 
      probcircle.pl [options]
 
  
  options:
+
Corecell.pl [options] in_image.i2i boundary.pts out_image.i2i [in_image2.i2i out_image2.i2i]
-D=# default = 1
 
-just_prob don't print the third column
 
  
  examples:
+
options:
      probcircle.pl | xmgrace -free -pipe -nxy -
+
-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 _)
  
  see also: p. 249 stereology_book.pdf
+
example:
    /home/lml/krypton/packages/fiji/stereology_lml.template
+
  #cell's length is in the xy plane, need to flip it to get cross sections to outline with planimeter3
    /home/lml/krypton/Corvera/Raz/stereology/plot_results.pl
+
  transp -YZ im.i2i im_YZ.i2i
    /home/lml/krypton/facil/cross_sections_of_sphere
+
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
  
 +
see also: shrink_wrap (to apply prior to Corecell.pl to get a better starting surface)
 
   
 
   
===  compare2dist ===
+
</nowiki>
incorrect command line.
+
===  count_2d_objs2.pl ===
This program calculates whether two amplitude distributions are the same.
+
<nowiki>
It was written to examine Rhonghua's STOCS data to determine whether the increase
+
run countobjs on a 2D time series
in observed STOC frequency could be explained by an increase in STOC amplitude
+
creates temporary files _temp.i2i and _temp.stats in the current directory.  
(since then more events above threshold would be observed)
+
note: scale and black level forces each time point to be rescaled the same and
datafile2 should be the one with larger amplitudes (so we hypothesize it has fewer missing
+
      therefore to be thresholded the same.
events if it is just a version of datafile1 shifted higher)It will get shifted down
+
file.stats will have data ordered as:
by a range of shifts (-s option) and compared with datafile1.
+
time number_of_objects mean_iod sd_iod mean_size sd_size
This routine also compares the temporal interarrival time distribution of each datafile with
+
 
that predicted by a poisson process and with the other datafile; the temporal calculations
+
count_2d_objs2.pl [options] image.i2i file.stats
ignore all missing data issues and shifting issues for now.
+
 
 +
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.
 +
 
 +
  -verbose
 +
  -dummy
 +
  -noclean
 +
 
 +
 +
</nowiki>
 +
===  distance2surface_overtime.pl  ===
 +
<nowiki>
  
This program reads data in the form:
+
Finds the distance (in pixels) of a specified pt (over time) from the nearest pixel
    time calcium prior_baseline post_baseline amplitude
+
greater than 0 in 3Dimage.i2i (or greater than -threshold).  Alternatively, finds
      where the values are
+
the distance to the boundary surface specified with the -surface option.
      time:            time of STOC
+
The coords is as produced by track_pts (x y z otherstuff).
      calcium:        SR calcium level
+
Written to let Andrea take a tracked gene in the nucleus and find its
      prior_baseline:  amplitude just prior to STOC
+
distance to the nuclear envelope over time.
      post_baseline:   amplitude just after STOC
+
Note: touching voxels may have a distance of .5 voxels, and voxels at the same
      amplitude:       amplitude amplitude of STOC (not relative to baseline)
+
       position may have a distance of -.5 (??)  
Data is expected to already be sorted by time (smallest to largest).
 
comment lines must begin with a #
 
  
Usage: compare2dist [options] datafile1 datafile2
+
distance2surface.pl [options] 3Dimage.i2i specifiedpt.coords outfile.dist
options:
+
 
    -t #: only include data with an amplitude > #. The default
+
options:
is to assume a 0 threshold. If you have acquired the data
+
-surface=boundary.pts find distance to the surface defined by boundary.pts
using some thresholding criterium (eg, only peaks above
+
  rather than the distance to nearest >0 voxel 3Dimage.i2i
10picoamps are counted) then you should provide that number
+
-shrink=#  shrink boundary.pts by this number of pixels before using it
here, even if all your data is above this (ie, you've applied
+
-expand=#  expand boundary.pts by this number of pixels before using it
the threshold in your identification phase). This is because
+
-zrange=#:#    only examine z slices (1-indexed in this range)
we need to know it when we shift amplitudes of the second
+
-threshold=#    threshold 3Dimage.i2i (voxels <= threshold set to 0, > threshold set to boundary).
distribution to see if it could match the first distribution.
+
-pixel=# pixel size (in x and y) in nm
    -b: subtract average baseline from amplitude prior to use (ie, prior
+
-verbose print out extra into to stderr as it goes along
to any thresholding or intensity shifting of data).
+
-vverbose very verbose
    -s delta max: shift datafile2 amplitudes down by a maximum of max, in
+
-keepfiles keep all intermediate files (all begin with _)
increments of delta, to see if it will then match datafile1.
 
  -p #: our guess of the percentage of data missing from datafile2 because it was
 
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 true.  But 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
+
This code is in ~lml/vision/Rhonghua/STOCS
+
</nowiki>
  #/home/lml/krypton/bin/compare2dist
+
===  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.
  
===  compare2gaussian ===
+
</nowiki>
incorrect command line, need 1 data files.
+
===  findpaths_exo4.pl ===
This program calculates whether a given set of data could be samples from a known mixture of Gaussians.
+
<nowiki>
datafile should have one data point per line. comment lines begin with #.
+
 
Output statistics to stdout.
+
this program takes output from exo4.
 +
similar to findpaths_exo3.pl, but parses exo4 output rather than exo3 output.
  
Usage: compare2gaussian [options] datafile
+
usage:
options:
+
  findpaths_exo4.pl file1.out  
      -t #: only include data with an amplitude > #. The default is to include all data.
 
  -g # amp1 mean1 sd1 ... :
 
The Gaussian mixture model the data should be compared against (using a KS statistic).
 
# is the number of Gaussians, this is followed by the amplitude, mean, and sd of
 
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.
 
  -T: test. runs through x = 0 to 10 and prints out cumulative prob. exits.
 
  
See Also: fitgaussians2, fit2gaussians, fit3gaussians
+
options:
  
Source code is in ~lml/krypton/Lefkowitz
+
which paths:
  #/home/lml/krypton/bin/compare2gaussian
+
  -prestring="# debugpath 3 (102,156,-1):"  pull out paths that begin with this. default is the null string.
 +
    : null string paths should also be saved_paths later.
 +
    : "# debugpath .*:"  will pull out all the debugpaths (. matches any char and * means
 +
    : number of them)
 +
  -saved_paths     : all the saved paths (within -zrange if that is also specifed)
 +
  -debugpaths     :  all the debug paths.  These options are mutually exclusive.
 +
  -zrange=minz:maxz     :  only print tracks which start within the z range specified (1-indexed, inclusive)  
  
=== compare_dist2 ===
+
what to do with the paths:
incorrect command line.
+
  -saved_labels=filename    : implies -saved_paths. saves labels for each path into the specified filename. This
This program calculates whether two distributions are the same using chi-square test (unless -k).
+
    : file can be read into play so that labels are visible at a location.
It was written to examine the distribution of sizes of Ryanodine Receptor objects
+
for rpts file:
to determine if they are randomly distributed. datafile1 should be the reference
+
  -rptsfile=track.rpts      :  create an rpts file (initially empty). use -rptstracks and -printfusion to put stuff in it.
data (gotten from many simulations or from a theoretical formula), datafile2
+
  -rptstracks     :  put paths (tracks) into the rpts file specified with -rptsfile    
should be the real data (max number of data values = 100000).
+
  -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 which is just a list of sizes of objects seen (one per line).
+
for xmgr file:
Comment lines must begin with a #
+
  -trackxmgr=track.xmgr    :  create an xmgr file of the tracks produced by the program "exo".
Floating pt numbers are truncated to integers for bin number (max bin number = 50000).
+
  -truetime     :  rather than use z value as "time" calculate time based on the "burst protocol"
 +
    :  of 60 seconds acquisition at 1Hz followed by 3 seconds at 20HZ, repeatedly.
 +
  -peak     :  rather than print avg (iod/size), print the peak pixel value (ie, value of maxima).
 +
  -finalfit     :  rather than print avg, print the best fit curve (based on final fit parameters).
 +
  -initfit     :  rather than print avg, print the init fit curve (based on initial fit parameters - for debugging).
 +
  -distance     :  rather than print avg, print the distance from the first pt on the curve.
 +
  -maxtracks=#     :  for -trackxmgr, only print out this many tracks.
 +
  -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: compare_dist2 [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
  -k perform K-S test instead (I'm not certain the numbins I use to calculate this is correct).
+
  play -min 0 adp12273_ids.i2i     # maxima of each region should be blue
  -a also print the histograms produced
+
  findpaths_exo4.pl -trackxmgr=adp12273.xmgr -truetime adp12273_c1_z1201_1320_masked.out
  -b also print the normalized histograms (total count datafile2 scaled to the same count as in datafile1,
+
  xmgr adp12273.xmgr    #clicking on each set brings up its legend info which has its
  bins with 0 removed), this is only done if -k not specified (ie, only if performing chi-square test).
+
        #starting coord (1-indexed I think) and value.
  -c also print the cumulative prob distributions (only done if -k also specified)
+
  findpaths_exo4.pl -rptsfile=adp12273.rpts -rptstracks -printfusion=4 adp12273_c1_z1201_1320_masked.out
  -r # #: only analyze sizes within the specified range (inclusive)
+
  addlines adp12273_c1_z1201_1320_masked.i2i adp12273.rpts - | play -P -1 R -P -3 G -
  -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 #
 
  -z: for chi-square keep zero entry bins (chi square only correct if this option is NOT used)
 
so why is this option here?  if you just really want to use this program to do
 
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.
 
  -v verbose
 
  -V very verbose
 
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
+
see also: ~lml/krypton/Huang/TIRF4/graph_exo3.csh
This code is in /home/lml/krypton/Zhuge/Ryr_clusters/
+
  #/home/lml/krypton/bin/compare_dist2
+
</nowiki>
 +
===  get_find_vesselness_results.pl  ===
 +
<nowiki>
 +
  Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at /home/lml/krypton/bin/get_find_vesselness_results.pl line 115.
  
===  correlationL ===
+
</nowiki>
/home/lml/krypton/bin/correlationL
+
===  mask_and_coloc.pl ===
incorrect command line.
+
<nowiki>
This program plots intensities from image1 vs intensities from
+
Takes a threshold, x and y translation for vinculin image, a pts file, and two images, and creates a mask
image2. image1 on the x axis, image 2 on the y axis. Intensities
+
and then calculates colocalization. See README.
in both images are rescaled 0 to the size of the output image
 
(default = 512).  The intensity at each pixel in the output
 
image is the number of (image1,image2) voxels with that particular
 
intensity combination.
 
The intent is to be able to look at the output image and get a sense
 
for whether there is a correlation between intensities
 
in the two images.  If so, perhaps a least squares line
 
fit should be done to see how well one images correlates with the
 
other, or -s option can be specified.
 
The minimum, maximum, and scale factors are printed to stdout.
 
Version 1.1
 
  
Usage: correlation [options] im1.i2i im2.i2i out.i2i
+
mask_and_coloc.pl -x=# -y=# -thresh=# -pts=file.rpts -vin=vin.i2i -trip=trip.i2i
options:
 
  -d xdim ydim: output dimensions of new image
 
(default = 512,512).
 
  -S im1scale im2scale: scale intensities with these scale factors. newval = (intens-min_intens)*scale
 
  -B b1 b2:    force min_intens (black level) to specified value. newval1 = (intens-b1)*scale1
 
  -i val1 val2: Ignore any voxels in image1 <= val1 and
 
any voxels in image2 <= val2.
 
  
  -h val1 val2: Ignore any voxels in image1 >= val1 and
+
options:
any voxels in image2 >= val2.
+
  -tx=# translate by a max of -tx when calculating other colocalization numbers, default = 25
 +
  -ty=#
 +
  -step=# step size for other translations, default = 5
 +
  -noclean don't clean up (ie, don't remove) intermediate files created during this analysis
 +
  -overlap=file   just calculate overlap3, reusing the other files, put result into file.
  
  -r: instead of intensities, use the rank
+
order of the intensities.
+
</nowiki>
  -a: automatically calculate the size of the
+
===  mask_gedmat_images4.pl  ===
output image. attempts to make the scale
+
<nowiki>
factor = 1.
+
  mask_gedmat_images4.pl  -check_intersect  added.
  -b: keep the xdim and ydim scale factors the same.
+
determines when outlines intersect and sets the aerr (area error flag) in the
  -s: calculate Spearman rank-order correlation
+
output file. eventually it will calculate areas a different way when that happens
coefficients. print results to stdout.
+
rather than combining masked images (see ~/krypton/Corvera/Raz/README for 10/18/13). not done yet ...
  -z zslice:    only examine the specified z slice (the first
+
 
slice is considered slice 0).
+
  Examines all the zip files (produced within fiji when outlining regions) in the current directory. These have
note: entire image name is NOT required.
+
  the boundary of the explant, day7 growth, and day11 growth.  
note: a - in place of an image name means stdin or stdout.
+
  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).  
  
examples:
+
  note: The algorithm assumes that the area NEVER DECREASES with time, and that the explant region is always surrounded
    # to apply this to a set of 3D images, using the same scales and size images for easy comparison
+
by the day7 region which is surrounded by the day11 region. The latter assumption is sometimes invalid if
correlationL -S s1 s2 -d 512 512 -B 0 0 image1.i2i corr1.i2i    (and same for other images)
+
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
===  create_imagesL  ===
+
-cond in gedmat_to_xy.pl to eliminate those stats from further analysis.)
incorrect command line.
+
It also assumes the smallest area in each zip file is the original explant area, the next largest area is
This program takes output from many runs of "overlap" and
+
called day7 area and the largest area (if 3 are present) is assumed to be day 11 area.
produces two images. One image is a percent colocalization image
+
Sometimes when growth is about 0, the outlines on, eg, day7, may have slightly less area than the original
and the other is a probability image.  The overlap program MUST be
+
explant, so the outlines might be mis-ordered then. [actually it may read the correct day off the name of
run via the "many_overlaps" command. The probability calculations
+
the i2i image now].
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
+
  note: If only 2 areas (ie, two .roi files) are present in the zip file, they are assumed to be for
(as originally specified to "many_overlaps") which overlap with
+
the explant and day7 (not day11).
voxels above threshold in image2. A 100 in the output image = 100 percent.
 
The probability of observing as much (or more) overlap as we did due to
 
random chance is the prob.i2i image.  Probabilities are mulitplied by 100.
 
  
Position along the y-axis (vertical axis) of the image, corresponds to
+
  note: This program assumes the center of the combined image (usually 4 well images are combined into one) is the
thresholds for image2. The x-axis represents image1 thresholds. The
+
center of the well. see combine_images.pl. It also assumes the combined image name ends in combined.i2i
lowest threshold is the bottom left corner. See the first line in  
+
(see -combined).
your datafile for the range of thresholds this represents.
+
 
Overlap produces statistics for a range of allowed overlaps.
+
  note: some of the scripts I use to then analyze these results will multiply the area by 2, to get a "true" estimate
Create_images, by default, chooses an overlap within 1 voxel.
+
  of growth; since the value produced by mask_gedmat_images3.pl will be (roughly) half of the real growth rates.
If you want to use a different overlap distance use the -o option.
 
  
See also: overlap, probcolocal, many_overlaps
+
  usage:
 +
mask_gedmat_images3.pl  [options]
  
Usage:
+
  options:
create_images [options] datafile percent.i2i prob.i2i
+
-tmpdir=fullpathname directory to use for temporary files which are created, eg: -tmpdir=/home/lml/krypton
options:
 
  -o distance:   voxels within this distance count as overlapped.
 
  -n number:    number of voxels (1000000 default), see probcolocal.
 
  
Examples:
+
-zip_file=file.zip
  many_overlaps -t 100 1000 100 -T 100 1000 100 alpha_T.i2i beta_T.i2i tmp_output
+
-zip_file=file.zip:file2.zip:...:filen.zip
  create_images -n 363264 tmp_output percent.i2i prob.i2i
+
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.)
== Analysis of Points ==
+
note: you may still need to specify -zip_ending so that the ending of this file can be stripped
=== components.pl -h  ===
+
      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.
  
Calculates the number of connected components resolved over a range of point densities.
+
-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.
  
components.pl [options]
+
-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.
  
options:
+
-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.
  
-numpts=low:hi:delta
+
-check_intersect check if outlines intersect with the explant's outline. If so, set an error flag on stdout printout
-repeat=# number of times to repeat at each point density
+
and print info to stderr.  eventually will just use area numbers rather than masking area in this situation.
-res=# in microns
+
that is not done yet ...  
-outfile=name name of output file. otherwise to _tmp. always need write permission in current directory.
 
  
 
===  convex_hull.pl  -h  ===
 
  
This program takes an object outputfile (unless -rptsin or -tripletsin) produced by countobjs (or maskobjs) and finds the minimal
+
-save_day[=directory]
spanning tree connecting the center of mass of the objects, and the convex hull. Writes out connections as an rpts file to stdout.
+
saves the final binary mask for each days growth (eg, day7 growth minus the explant and minus the part growing towards the wall)
It also loops through 20 thresholds  for the pts, and prints to stderr some stats about the minimal spanning tree and
+
into a 3d mask image (patientid_tissue_day#_mask.i2i).  This image will be reduced down in xdim and ydim from the
convex hull of the points above each of these thresholds.
+
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
  
Options can be used to only selected a subset of the objects and to constrain the maximum distance (-maxdist).  
+
-just_check just check whether each zip roi outline has the correct number of associated image files.
 +
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.
 +
-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.
  
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
+
  see also:
convex hull area, so that when the threshold rises high enough, only maxima inside the cell will still be present and hence
+
/home/lml/krypton/Corvera/Raz/README
the convex hull will be stable and of much smaller area.
+
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
 +
 
 +
  examples:
 +
cd /storage/big1/raz/GEDMAT/006_JTH/OM
 +
 
 +
# generate 006_JTH_OM.areas with all the data (area_mex_border is the number which should replace farea)
 +
# 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
  
This program requires perl modules Graph::Kruskal and Math::Geometry::Planar, use cpanp to install these:
+
# 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):
    yum install perl-CPANPLUS-0.91.3-202.fc16.noarch  - for cpanp
+
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 -
    cpanp -i Graph::Kruskal
 
    cpanp i Math::Geometry::Planar
 
  
usage:
 
  convex_hull.pl -tripletsin file1.triplets  > file1_mst.rpts
 
  
  input options:
+
# run with some diagnostics:
    -dx=#   spacing in the x direction, default = 1
+
cd /storage/big1/raz/GEDMAT/006_JTH/OM
    -dy=#   spacing in the y direction, default = 1
+
/home/lml/krypton/bin/mask_gedmat_images.pl -tmpdir=/home/lml/krypton/Corvera/Raz -zip_ending=_Area.zip
    -dz=#   spacing in the z direction, default = 1
+
        -results_ending=_Results.txt -combined_ending=combined.i2i -days=7:11
    -rptsin     instead of file1.objs, read file1.rpts where file1.rpts was produced by max2d.
+
        -save_day=/home/lml/krypton/Corvera/Raz/006_JTH_OM_7masks.i2i    > /home/lml/krypton/Corvera/Raz/006_JTH_OM.areas
      -size1 and -iod1 are ignored when this option is specified.
+
# play.FC14 allows labels to have comment lines (first character of line is a #)
    -tripletsin   instead of file1.objs read in file1.xyi,  triplets of x y and intensity.
+
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 -
  
  analysis options:
 
    -size1=min:max     min and max object size allowed for file1.objs in pixels (inclusive)
 
    -iod1=min:max   min and max object iod allowed for file1.objs (inclusive), or intensity if -tripletsin was specified.
 
    -maxdist=#: :  don't allow connections between pts further apart than this distance (after applying dx, dy, dz spacing factors).
 
  warning: if the distance is too small, then all the pts will not be connected to begin with;
 
    this may cause the minimal spanning tree algorithm to fail.
 
    default maxdist is  3000
 
  
  output options:
+
# do a bunch of stuff
    -addlines :  output rpts format which addlines is more likely to be happy with (may not work in dave?)
+
analyze_gedmat3.pl # apply this perl script to lots of data
    -hist :  calculate histogram of distances (hist[int(dist)]++, where int just truncates to integer). obsolete.
+
cd output
    -sizehist :  calculate histogram of object sizes (in voxels) in file1.out. (hist[int(size)]++, where int just
+
      play_results3.pl 006_JTH_OM_day7  # look at some of it
        truncates to integer). If you don't care about distances between two files (ie, only want -sizehist)
+
raz_rates.pl # generate stats
        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:
+
   source code: in /home/lml/krypton/bin/mask_gedmat_images.pl
    -silent :  suppress warning messages.
 
    -verbose
 
-debug
 
  
example:
+
  convex_hull2.pl -tripletsin -jack=jack.rpts:5 -addlines -twod -maxdist=100 file1.triplets > file1_mst.rpts
+
</nowiki>
  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 -
+
===  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:
  
 +
1. @stats = &outline_stats(@outline) was used to calculate explant center (for masking) but
 +
        the meanx and meany are just the mean of the outline, it is NOT a center of mass. usually ok for a compact explant.
 +
  sub calc_com() is now used instead to calculate the true center of mass.
 +
-use_explant_outline will cause the OLD method to be used instead.
  
see also:
+
2.   bounding box was used to calculate area for sorting the outlines temporally (from smaller to larger area).  
   convex_hull, objs2mst.pl
+
      but when outlines intersect bounding box can at times NOT be a good surrogate for area.
  objs2bb.pl, objs2dist.pl, objs2dist121.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent
+
  $roi_area[$r] = ($maxx-$minx)*($maxy-$miny); 
  resolve_pts
+
  handled these two issues by writing sub calc_com().
 +
-use_bbox_area will cause the OLD method to be used instead.
  
 
===  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
+
note: fiji areas are already sorted smallest to largest when I first bring them in (extract_area2.pl does that):
from the center of mass of objects in file1.out to the center of mass of objects in file2.out.
+
  $prev_results = `extract_area2.pl -justfiles=$resultsfile`
 +
  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.
  
If both file arguments are the same (e.g., objs2dist.pl file1.out file1.out >file.dist), you can use this
+
  mask_gedmat_images4.pl  -check_intersect  added.
routine to find the distances between objects within an image (an object match with the same id is automatically
+
determines when outlines intersect and sets the aerr (area error flag) in the
ignored in this case so objects don't match to themselves). See also the option -skipsame.
+
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). right now only sets the error flag.
 +
 
 +
  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).
 +
 
 +
  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).
 +
 
 +
  note: some of the scripts I use to then analyze these results will multiply the area by 2, to get a "true" estimate
 +
  of growth; since the value produced by mask_gedmat_images3.pl will be (roughly) half of the real growth rates.
 +
 
 +
  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.  
  
(modified from /storage/big1/lml/was_voxel/Corvera/track/objs2bb.pl)
+
-check_intersect check if outlines intersect with the explant's outline. If so, set an error flag on stdout printout
 +
and print info to stderr.  eventually will just use area numbers rather than masking area in this situation.
 +
that is not done yet ...  
  
usage:
 
  objs2alldists.pl file1.out file2.out >file.dist 
 
  
options:
+
-save_day[=directory]
  -dx=# :  spacing in the x direction ,default = 1
+
saves the final binary mask for each days growth (eg, day7 growth minus the explant and minus the part growing towards the wall)
  -dy=# :  spacing in the y direction ,default = 1
+
into a 3d mask image (patientid_tissue_day#_mask.i2i). This image will be reduced down in xdim and ydim from the
  -dz=# : spacing in the z direction ,default = 1
+
original. patientid_tissue_day#_.play_labels will also be created (labels which well each z slice comes from).
  -size1=min:max : min and max object size allowed for file 1 in pixels (inclusive)
+
This is mostly for quality control purposes.
  -size2=min:max :  min and max object size allowed for file 2 in pixels (inclusive)
+
In addition, patientid_tissue_day#.rpts will be created (similarly reduced down in size) (coords may be off by 1?).
  -iod1=min:max : min and max object iod allowed for file 1 (inclusive)
+
View the file via: addlines maskim.i2i maskim.rpts |play.FC14 -P -1 R -labels maskim.play_labels -
  -iod2=min:max :  min and max object iod allowed for file 2 (inclusive)
+
  or via: play_results3.pl
  -maxdist=#: : don't allow matches further away than this distance (after applying dx, dy, dz spacing factors).
+
patientid_tissue_day#_orig.i2i will be the original images (also reduced in xdim and ydim, and only one 2d slice
  default maxdist is ~  3000.
+
from each original 3d image).
  -hist : calculate histogram of distances (hist[int(dist)]++, where int just truncates to integer).
+
note: older versions of play may need the comment line at the top of maskim.play_labels removed.
  -sizehist :  calculate histogram of object sizes (in voxels) in file1.out. (hist[int(size)]++, where int just
+
note: if you want images to be in another directory, specify a full pathname, eg -save_day=/home/lml/krypton (without last /).
  truncates to integer). If you don't care about distances between two files (ie, only want -sizehist)
+
note: any existing file with these names will be OVER-WRITTEN.
  put the same file name for both files on the command line.  
+
note: this option creates lots of temporary files (in tmpdir) of the form __*.i2i, any existing
  -rpts=file.rpts :  put bounding boxes around objects found and lines between closest objects (similar to objs2bb.pl)
+
      files that match this will be DELETED.  
  display this in dave eg:  dave -n 0 -u -I file.i2i file.rpts (use the -n 0 and -u options)
+
see also: montage
  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.
+
-patient5 patient5 files have some odd naming. use this option if analyzing them.
  # 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
+
-use_explant_outline legacy. specify this if you want the center of the explant to be based on the average of the pixel positions
  names are too long.
+
of just the pixels along the boundary (rather than the center of mass).
  -tyz : transpose coords in yz before writing them to the rpts (must specify -rpts option)
+
-use_bbox_area legacy. specify this if you want to order the outlines based on their bounding box area rather than their true area.
  -skipsame :  don't match an object in file1.out to an object with the same id in file2.out
+
You should probably specify both options (if you want either one), I'm not sure about consistency if only one is specified.
  This is set automatically if file1.out = file2.out.
+
 
   -silent :  don't print the distances (sets -hist)
+
-just_check just check whether each zip roi outline has the correct number of associated image files.
  -simpleprint :  when printing distances, just print distance, one per line, nothing else. to be read in
+
eg, if the zip file has 3 outlines (explant, firstday, secondday) there should be two i2i files with DAY# in their name.
  by ~/Zhuge/grants/AsthmaRO1/distance_distribution.m. note: that program assumes distances
+
prints to stderr info about those which don't have the correct number. does nothing else.
  are in pixels and pixels are 80 nm, unless you specify pixelsize=somethingelse.
+
-just_stats goes a bit further than -just_check (does that too), sets -verbose and prints out stats about each outline. then exits.
   -simpleprint2 :  like simpleprint, but the first column is id of the Ryr to which this BK is closest.
+
-verbose some extra info to stdout
  -onelineprint :  like objs2alldists.pl  but prints the distance to ALL the objects (within -maxdist),
+
-debug prints some tracing info to stderr
  not just the closest on one line, so we can keep track of which BK are near which Ryr.
+
-print_fname print name of each zip file as it is being analyzed, to stderr.
  see comdists3.pl (which uses this option).
+
-dlevel=# extra debugging. the bigger the number the more the printout. # is an integer starting at 1.
  -verbose
+
-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.
 +
 
 +
   see also:
 +
/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
 +
 
 +
   examples:
 +
cd /storage/big1/raz/GEDMAT/006_JTH/OM
 +
 
 +
# generate 006_JTH_OM.areas with all the data (area_mex_border is the number which should replace farea)
 +
# 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
  
example:
+
# compare the full areas produced which what fiji did (as a check). only pull out the good data. they should be very similar:
  countobjs -k -t 2000 2000 wave1.objs wave1.i2i
+
cd /home/lml/krypton/Corvera/Raz
  countobjs -k -t 2000 2000 wave2.objs wave2.i2i
+
gedmat_to_xy.pl -cond='if (($date eq "date_sure")&&($perr==0)&&($aerr==0)) {1;} else {0;}'
  objs2dist.pl wave1.objs wave2.objs > wave1and2.dist
+
-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
 +
 +
 +
</nowiki>
 +
===  membrane3D.pl  ===
 +
<nowiki>
 +
 +
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.
 +
 +
step 1. options for converting i2i to mhd:
 +
  -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.
 +
 +
step 2. options for cellPreproces:
 +
this may produce an unsigned char image (?)
 +
  -median=# radius of median filtering preprocessing (and hole filling). If this is not specified it isn't done.
 +
 +
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.
 +
 +
  note: it may be necessary to do the above operations, which also convert the image into unsigned char, which is required for
 +
step 4, multiscalePlateMeasureImageFilter?
 +
  note: step 6 (watershed) may also work best if the pixel sizes are the same in all directions.
 +
 +
step 4. options relating to planarity:
 +
the planarity image produced will be doubles from 0-1.
 +
  -planar=# the sigma of the Gaussian used when classifying pixels as planar or not. default = 1
 +
  -alpha=# see the help for /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/multiscalePlateMeasureImageFilter
 +
  -beta=# ditto
 +
  -gamma=# ditto
 +
  -c=# ditto
 +
  -planaropts="options for multiscalePlateMeasureImageFilter here" 
 +
available options (so far, but anything specified here will be passed), : -a # -b # -g # -c # -d -s -B -T
 +
options which go here should be specified in the format that multiscalePlateMeasureImageFilter wants them,
 +
for example: -planaropts="-c 5 -d -B"
 +
not in the alternative format that Membrane3D.pl desires (e.g. -planaropts="-a 5" is correct, -planaropts="-alpha=5" is wrong).
 +
    -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)
 +
 +
step 5. options relating to voting:
 +
the resulting tensor vote image will be unsigned chars from 0-255.
 +
  -region=# the sigma which defines the region within which a pixel influences other pixels. default = 10
 +
 +
step 6. options relating to watershed segmentation:
 +
The resulting image will be long ints (id numbers) of regions. 
 +
                See the help for /home/lml/krypton/segmentation/MR-Source/ACME/ACME-Binary/bin/membraneSegmentation
 +
  -thresh=# threshold value. this is applied to the tensor voting image to turn it into a binary image. then a  distance
 +
transform and watershed are applied. default = 128
 +
  -segopts="options for membraneSegmentation here"   
 +
for example:  -segopts="-S -l 20 -a 5 -c -D" will use this exact string as options.
 +
options so far: -S -l # -a # -s # -n -i # -w # -m # -c -v -d -D
 +
 +
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:
 +
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
 +
# -convert: just put correct pixel size info into an mhd header
 +
# -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: /home/lml/krypton/segmentation/MR-Source/ACME/lmltest/README
 +
  /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
 +
 +
 +
</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).
 +
 +
stats.pl [options]  > stats.out
 +
  -nothing : do nothing, just echo what would be done
 +
  -h : print this help
 +
  -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:
 +
  run.pl [options]
 +
 +
options:
 +
  -dir=directorypath    : without the final slash. directory to analyze. default = /mnt/big3/rzg/mtc/immunocytochemistry/july05/imcc/70105/epr
 +
  -ryrthresh=# : threshold for ryr (488) images, default =
 +
  -min_ryrsize=# : minimum allowed object size in pixels, default = 5
 +
  -max_ryrsize=# : max allowed object size in pixels, default = 150
 +
  -min_ryriod=# : minimum allowed object iod, default = 354
 +
  -max_ryriod=# : maximum allowed object iod, default = 10000000
 +
 +
  -bkthresh=# : threshold for bk (594) images, default =
 +
  -min_bksize=# : minimum allowed object size in pixels, default = 5
 +
  -max_bksize=# : max allowed object size in pixels, default = 50
 +
  -min_bkiod=# : minimum allowed object iod, default = 4686
 +
  -max_bkiod=# : maximum allowed object iod, default = 10000000
 +
 +
  -dx=# : relative distance in x, default = 1
 +
  -dy=# : relative distance in y, default = 3
 +
  -dz=# : relative distance in z, default = 1
 +
 +
  -noclean
 +
  -debug
 +
  -verbose
 +
 +
 +
</nowiki>
 +
===  countobjs  ===
 +
<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.
 +
 +
Notes:
 +
  A - in place of an image name means stdin or stdout.
 +
  Source code in /storage/big1/lml/jac/was_invitro/Projects/countobjs
 +
 +
 +
</nowiki>
 +
===  countobjsmax3d  ===
 +
<nowiki>
 +
Usage:
 +
  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.
 +
 +
  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:
 +
  -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). 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.
 +
 +
Notes:
 +
  A - in place of an image name means stdin or stdout.
 +
  Source code in /storage/big1/lml/jac/was_invitro/Projects/countobjs
 +
 +
 +
</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
 +
 +
 +
</nowiki>
 +
===  2Ddistances  ===
 +
<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:
 +
2Dhistogram [options] inimage.i2i inmask.i2i
 +
Options:
 +
  -v: verbose
 +
 +
Source code in ~krypton/lml/facil 
 +
  -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
 +
 +
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.
 +
 +
</nowiki>
 +
===  analyze_histo  ===
 +
<nowiki>
 +
# /home/lml/krypton/bin/analyze_histo
 +
 +
Analyzes the output histogram image produced by histogram2 via the -f option.
 +
Prints out 2 columns: first column is bin number, second column is value at the cutoff.
 +
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: analyze_histo [options] aimage_H.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
 +
 +
See also: histogram, histogram2, threshold
 +
 +
source code in /storage/big1/lml/jac/was_invitro/Projects/boundary/boundary
 +
 +
</nowiki>
 +
===  analyze_yaodl  ===
 +
<nowiki>
 +
 +
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.
 +
 +
Usage: analyze_yaodl [options] infile.ydl
 +
options:
 +
  -y largest.ydl:  write out largest surface of eac object to largest.ydl
 +
  -i image.i2i:  read in the image file associated with infile.ydl (not needed for anything yet).
 +
        -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.
 +
 +
</nowiki>
 +
===  BestPath  ===
 +
<nowiki>
 +
 +
Finds the brightest path from a start pixel to a stop pixel (1-indexed).
 +
 +
Usage:
 +
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
 +
 +
Source code in ~krypton/lml/facil 
 +
 +
</nowiki>
 +
===  BestPath3D  ===
 +
<nowiki>
 +
 +
Finds the brightest path from a start pixel to a stop pixel (1-indexed).
 +
Converts voxels into nodes in a graph and finds the lowest cost path from the start node to the stop node.
 +
The cost of each node is (maxval-imval), so bright nodes have less cost. Output in rpts format to stdout.
 +
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: make_spiralim, BestPath, BestPath2, make_ellipsoid, DAVE -> Stuff -> Best Path ...
 +
 +
Source code in ~krypton/lml/facil 
 +
 +
</nowiki>
 +
===  BestPath3D_ellipse  ===
 +
<nowiki>
 +
 +
Finds the brightest path from a start pixel to a stop pixel (1-indexed).
 +
Converts voxels into nodes in a graph and finds the lowest cost path from the start node to the stop node.
 +
The cost of each node is (maxval-imval), so bright nodes have less cost. Output in rpts format to stdout.
 +
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: make_spiralim, BestPath, BestPath2, make_ellipsoid, DAVE -> Stuff -> Best Path ...
 +
 +
Source code in ~krypton/lml/facil 
 +
 +
</nowiki>
 +
===  boundaryL  ===
 +
<nowiki>
 +
Usage:
 +
  boundary [options] original.i2i
 +
 +
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.
 +
 +
Caveats:
 +
  Requires lots of memory and time to run (megabytes+minutes).
 +
 +
Notes:
 +
  Entire image name (with extension) is required.
 +
  Pixel values: boundary = 2, outside = 4, inside = 6.
 +
  Output image is padded on all sides by 2*radius+1 of
 +
  sphere rolled on the outside of the object.
 +
 +
Keywords:
 +
  surface location, boundary, boundaries, border
 +
 +
Additional programs:
 +
  histogram, shrink_wrap, createBoundary, analysis
 +
 +
Last Changed: Wed Feb 10, 1993
 +
 +
 +
</nowiki>
 +
===  calc_area  ===
 +
<nowiki>
 +
 +
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.
 +
 +
Typically one might apply a shrink_wrap to, say, a Vinculin image of a dual
 +
labelled image pair.  Then make_surface would convert this to a surface.
 +
After this, map_to_surface would be applied to the 2 dual labelled images.
 +
Then overlap would be used to calculate the overlap of the two data sets
 +
(given some overlap range, which defaults to 1).
 +
Then this program (calc_area) is used to get the area of the surface and the
 +
amount of it which is examined using the range specified to the overlap program.
 +
This is important since to calculate the probability that the overlap was
 +
due to chance you want to know what percentage of the area was included in
 +
the overlap calculation.
 +
 +
Usage: calc_area [options] surface.i2i data.i2i
 +
options:
 +
  -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.
 +
 +
Source code in /storage/big1/lml/was_invitro/Moore/pkc
 +
 +
</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" 
 +
 +
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 
 +
 +
</nowiki>
 +
===  closest_voxel  ===
 +
<nowiki>
 +
 +
Calculates the closest distance from an above threshold voxel in image1 to an above threshold voxel in image2.
 +
Histogram of these distances is printed to stdout.
 +
 +
Usage:
 +
closest_voxel [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
 +
-s lowx lowy lowz hix hiy hiz:  only look at voxels within this subvolume, 1-indexed, inclusive.
 +
-Q: only the voxel in each image1 object closest to an image2 voxel should count.
 +
Use this if image1.i2i was created via the -Q option from countobjs.
 +
-o minsize maxsize:    only look at objects in image1.i2i within the size range (inclusive, in voxels)
 +
must use -Q option along with this.
 +
-p: also print the detailed info of which voxel matched to which other voxel
 +
  -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_voxel -w 1 1 3 -o 5 100 -Q 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:
 +
graph.pl
 +
Bugs:
 +
 +
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
 +
 +
</nowiki>
 +
===  coloc3ims  ===
 +
<nowiki>
 +
 +
 +
This programs reads in three images and produces a new version of image3.
 +
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.
 +
 +
</nowiki>
 +
===  coloc_tseries2  ===
 +
<nowiki>
 +
 +
Similar to coloc_tseries, but compares a 2D time series to itself.
 +
Prints xmgr formatted graphs to stdout.
 +
 +
Usage: coloc_tseries2  image1 outfile
 +
options:
 +
-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
 +
 +
source code in:  /home/lml/krypton/facil
 +
 +
see also: /home/lml/krypton/Corvera/paper2010/Dynamics_in_Dave/README
 +
 +
</nowiki>
 +
===  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
 +
 +
Usage: com_2d_objs [options] image.i2i
 +
options:
 +
  -z start stop: zplanes to analyze. 0-indexed inclusive. default is all z planes
 +
  -r #: put data out rpts format (integer coords, only center of mass info). Only use if only one object.
 +
# is the pixel value (!= 0), usually -1 through -7.
 +
  -o: coords should be one-indexed (ie, min x = 1). default = 0. -r sets this automatically.
 +
  -v: verbose
 +
 +
Source in /home/lml/krypton/facil
 +
See Also: /home/lml/krypton/Lawson/Jacques/README
 +
 +
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.
 +
 +
peak intensity profile:
 +
  pintens                  ----------------
 +
                          |                |
 +
                        |                  |
 +
                        |                    |
 +
  tintens -------------                      ------------------
 +
 +
          0  t1      t2                  t3
 +
          0  t1      |prise|              |ffall|
 +
 +
t1: time of tethering (should stop moving)
 +
t2: time of priming (peak intensity increases from tintens to pintens)
 +
t3: time of fusing (peak intensity drops back down, but iod should stay high and possibly even increase a bit)
 +
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.
 +
 +
Should work in 2d or 3d.  Only reads in a window of time points at once
 +
so should be able to handle large images.
 +
 +
Usage:
 +
  exo4 [options] inimage.i2i  > inimage.count
 +
 +
Options:
 +
 +
options related to input:
 +
  -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 rptsfile.  should 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).
 +
 +
Phase 1: options related object finding via ascent (see objs_via_ascent2d), info printed out.
 +
          If an object doesn't satisfy these criteria, its maxima is not kept, so it is not considered a maxima
 +
          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:
 +
  objs_via_ascent,  ~lml/krypton/Huang/TIRF4/found4.pl, run7
 +
#/home/lml/krypton/bin/exo4
 +
 +
 +
</nowiki>
 +
===  exo6  ===
 +
<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.
 +
 +
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
 +
 +
Usage:
 +
  exo6 [options] -readmax max.rpts inimage.i2i  > inimage.count
 +
 +
Options:
 +
 +
options related to input:
 +
  -T startt stopt : only examine these time points (0-indexed, inclusive)
 +
  -r rptsfile : read in rptsfile.  should 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).
 +
  -readmax file : read maxima in from the specified file (this is REQUIRED)
 +
 +
options related to finding fusion events:
 +
  -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.
 +
  -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
 +
  -startfall time   how close (in timepts) in time the peak intensity must start to fall in relation
 +
  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
 +
 +
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.
 +
  -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
 +
exo6 -v -r mask.rpts -d 600 
 +
  -readmax max.pts  -s 10 1000 -i 10 1000000 -t 1
 +
      -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 in /home/lml/krypton/facil
 
see also:
 
see also:
   objs2dist121.pl, closest_object, closest_voxel, countobjs, maskobjs, objs_via_ascent, pt_distances
+
  objs_via_ascent,  track_back2, ~lml/krypton/Huang/TIRF4/findpaths_exo5.pl, run7, graph_exo3.pl
 
+
#/home/lml/krypton/bin/exo6
 +
 
 +
 
 +
</nowiki>
 +
===  find_2d_objs  ===
 +
<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:
 +
find_2d_objs [options] image1.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
 +
using addlines.
 +
A contour in .rpts format can be converted into the native
 +
GSNAKE .con format using rpts2con.
 +
For more information on snakes refer to
 +
http://www.cs.wisc.edu/computer-vision/projects/gsnake.html
 +
 
 +
Usage    :snakeTrack <image> <input rpts|con> <output rpts> [option]
 +
[ option ]
 +
-V          :verbose - show the multiresolution pyramid.
 +
-L#          :Number of levels of resolution, default 2
 +
-S#          :Stratified search segment spacing, default 2
 +
-N#          :The size of the neighbourhood around
 +
              a snaxel to be searched, default 2
 +
-D#          :Desired spacing between snaxels.
 +
              Default 5.  The program will try to keep
 +
              the spacing constant by inserting new snaxels.
 +
              It doesn't seem to do a good job deleting extra snaxels.
 +
-E/i/e/m    :External energy input type, default e
 +
              i - Use intensity as external energy value
 +
              e - Use edge magnitude and direction calculated
 +
                  automatically from the input image.
 +
              m - Use edge magnitude only, calculated automatically
 +
-slice # # :specify 0-based index of the first and
 +
              the last slice of the sequence
 +
 
 +
Note: options (L, S, N, D) must not have a space before arg.
 +
 
 +
Keywords: deformable model, active contour.
 +
 +
</nowiki>
 +
===  thin3Ds  ===
 +
<nowiki>
 +
 
 +
This program is for thinning (i.e., finding the skeleton or medial axis)  3D
 +
objects.  It is modified from Lee, Kashyap, and Chu (a parallel algorithm).
 +
The program attempts to thin the object, leaving only "center" voxels.
 +
It peels off outer layers until just the "medial" axis is left.
 +
Then the program converts the thinned image into a set of vectors in rpts format.
 +
The motivation behind this program is for creating thin lines (vectors)
 +
from an image data set.  These lines stay thin even when zoomed way up in DAVE.
 +
 
 +
This program is similar to thin3Dp but uses a sequential implementation rather
 +
than the parallel implementation of thin3Dp.  This version has no known bugs.
 +
Diagnostics (logfile info) are printed to stderr.
 +
 
 +
Usage: thin3Ds [options] image.i2i vectors.pts
 +
  -t #:  pixels above this are foreground (default = 0)
 +
  -n name: name of vectors put into vectors.pts.  The default = pixel_vectors
 +
DAVE requires objects in each pts file to have a different name.
 +
  -r: only keep rings.  all side_spurs should be removed.
 +
  -X low hi: only examine the image from low to hi in x (0 indexed)
 +
  -Y low hi: only examine the image from low to hi in y (0 indexed)
 +
  -Z low hi: only examine the image from low to hi in z (0 indexed)
 +
  -i filename:  create an i2i image of the center voxels.
 +
use this if you want to do further pruning (via "prune" command)
 +
 
 +
options for debugging:
 +
  -s rootname freq: save intermediate images to the specified file (rootname).
 +
    save them with a frequency of freq (1=save every, 2= every other, etc.
 +
  -p pass: save all the subpasses of this pass.filnames will be:
 +
"pass#_subpass#.i2i" unless -s is also specified in which case
 +
they will be "rootname#_subpass#.i2i"
 +
note: if you also want the -s option, you must specify it AFTER
 +
      this option on the command line.
 +
 
 +
example:
 +
    thin3Ds -i data_center.i2i data.i2i data_thinned.pts
 +
    prune data_center.i2i data_pruned.i2i
 +
    im2pts -n data_pruned data_pruned.i2i data_pruned.pts
 +
    DAVE -n 0 -I data.i2i data_pruned.pts
 +
 
 +
note: The only program which will correctly read in the pts file produced is DAVE.
 +
        This is because many vertices in the file should not be connected to their
 +
        previous vertex, and only DAVE correctly recognizes this.
 +
You MUST use the -n 0 option with DAVE when reading in the pts file produced.
 +
 
 +
See also: distance_transform followed by max_planes and im2pts
 +
  see also: thin (a distance based thinning algorithm)
 +
            lee94-3dskeleton.pdf (the algorithm which thin3Ds implements).
 +
            ImageJ (Fiji -> Plugins -> skeletonize 2D/3D which is an implementation of the same algorithm
 +
http://imagejdocu.tudor.lu/doku.php?id=plugin:morphology:skeletonize3d:start
 +
http://imagejdocu.tudor.lu/doku.php?id=plugin:analysis:analyzeskeleton:start
 +
  see also: prune
 +
 
 +
Source code in /home/lml/krypton/was_big1/was_invitro/Doxsey
 +
/home/lml/krypton/bin/thin3Ds
 +
 
 +
</nowiki>
 +
===  track  ===
 +
<nowiki>
 +
#/home/lml/krypton/bin/track
 +
 
 +
Thresholds inimage.i2i. Connected voxels define regions.
 +
Tracks regions over time (if -n specified). Tracks written to stdout in rpts format.
 +
A 1-pixel border around the image is set to background.
 +
 
 +
Usage: track [options] inimage.i2i
 +
options:
 +
  -a #: which match algorithm to use. 1: simple. 2: greedy (better)
 +
        3: min cost (best). default = 1.
 +
  -C #: what cost algorithm to use for track terminations (merges) and starts (splits).
 +
The default is 1, constant high cost. 2 means smaller regions
 +
incur less cost.
 +
  -p: add a penalty for a match which displaces a great match (only with -a 3)
 +
  -n #:  number of sets (ie, time points in a 4D data set)
 +
  -m # #: allow paths to merge (or split) if manhattan distance between bboxes of
 +
the regions is less than # and iod change is less than # (5.000000 and 0.200000 good values?)
 +
  -s # #:  which sets to analyze (0 indexed, inclusive). must specify -n with this.
 +
default is all sets.
 +
  -t #:  an object has voxels > #. default = 0
 +
  -S: autoscale each time point to be between 0 and 255. threshold is applied after this.
 +
this lets one compensate, eg, for bleaching over time and makes the slider value shown
 +
by DAVE when it autoscales directly applicable to track.
 +
  -v # #: an object has between # and # voxels in it, inclusive, ie, object size. default = 1 10000
 +
  -c #:  connectivity. #: 4 (2d), 8 (2d), 6, 18, 26 (3d). default = 26
 +
 
 +
  -o # # outimage.i2i:  write out time points # through # (0-indexed,inclusive) with voxels numbered
 +
                      according to their track. note: should not need to use imsets program afterwards
 +
on outimage.i2i.  You can give numbers outside zdim (ie, -o -1 1000 would insure all
 +
time pts save regards of numsets)
 +
  -O # # outimage.i2i:  same as -o, but writes out original voxel values (voxels not in objects set to 0).
 +
  -r: print extra info (to stdout) about each region found.
 +
  -d # #: maximum delta x (or y) (in voxels), max delta z for an allowed match along a track
 +
default=any.
 +
  -u # # # #: units for velocity measurements. x y z voxel size (um) and delta t (in sec).
 +
  -h # file: bin width (um/sec) and file name for velocity histogram (must specify -u). defaults =
 +
                0.010000 (um/sec) and vel_hist.xy
 +
  -M :         also print cube outlines of the maxima in the regions (in rpts format) to stdout.
 +
  -i image.i2i: write out costs used as an image (max truncated to 32767). For diagnostic purposes.
 +
x axis in region at time t, y axis is region at time t+1.
 +
  -V :         verbose
 +
 
 +
examples:
 +
    track -t 660 -n 100 -s 0 5 wt1_r.i2i > tracks.rpts
 +
    dave -4 -I wt1_r.i2i -kptcolor -n 0 -u tracks.rpts
 +
 
 +
    track -t 660 -n 100 -o -1 1000 wt1_obj.i2i -s 0 5 wt1_r.i2i > tracks.rpts
 +
    dave -4 -I wt1_obj.i2i -kptcolor -loadmap random.map -n 0 -u tracks.rpts
 +
 
 +
source code in ~lml/voxel/Corvera/track
 +
 +
</nowiki>
 +
===  track3d  ===
 +
<nowiki>
 +
#/home/lml/krypton/bin/track3d
 +
 
 +
Reads in mulitiple 4D images. Thresholds the images. Connected voxels define regions.
 +
Tracks regions over time (if -n specified). Tracks written to stdout in rpts format.
 +
A 1-pixel border around the image is set to background.
 +
All images must be the same xdim, ydim, and zdim (after divison by tdim). tdim can vary from image file to image file.
 +
Image files must have their tdim set correctly (see imsets program).
 +
 
 +
Usage: track [options] inimage.i2i [inimage2.i2] ... [inimageN.i2i]
 +
options:
 +
  -a #: which match algorithm to use. 1: simple. 2: greedy (better)
 +
        3: min cost (best). default = 1.
 +
  -C #: what cost algorithm to use for track terminations (merges) and starts (splits).
 +
The default is 1, constant high cost. 2 means smaller regions
 +
incur less cost.
 +
  -p: add a penalty for a match which displaces a great match (only with -a 3)
 +
  -n #:  number of sets (ie, time points in a 4D data set). Use if only 1 input file and it has a bad tdim.
 +
  -m # #: allow paths to merge (or split) if manhattan distance between bboxes of
 +
the regions is less than # and iod change is less than # (5.000000 and 0.200000 good values?)
 +
  -s # #:  which sets (time points) to analyze (0 indexed, inclusive, concatenated across all input files).
 +
default is all sets. Note, currently all sets before start set are read and then
 +
discarded, so it might be slow to skip many sets (time points).
 +
  -t #:  an object has voxels > #. default = 0
 +
  -e numbkgnd hwidth delta ptsfile:  rather than find regions by just thresholding, find regions by finding maxima.
 +
A maxima still has to be above the threshold (-t) in intensity, and must be at least
 +
"delta" greater in intensity than its neighbors (e.g, .5).  The halfwidth of the
 +
neighborhood is "hwidth" (ie, 1 means +/- 1 pixel).  A pixel is also not allowed to
 +
be a maxima if more than "numbkgnd" neighboring pixels are background pixels (ie, <= threshold).
 +
If "ptsfile" is not "none" a pts file of the specified name will be written of the maxima.
 +
zdim should be >> hwidth if it isn't = 1 (i.e., if it isn't a 2D time series).
 +
  -S: autoscale each time point to be between 0 and 255. threshold is applied after this.
 +
this lets one compensate, eg, for bleaching over time and makes the slider value shown
 +
by DAVE when it autoscales directly applicable to track.
 +
  -v # #: an object has between # and # voxels in it, inclusive, ie, object size. default = 1 10000
 +
  -c #:  connectivity. #: 4 (2d), 8 (2d), 6, 18, 26 (3d). default = 26
 +
 
 +
  -o # # outimage.i2i:  write out time points # through # (0-indexed,inclusive) with voxels numbered
 +
                      according to their track. note: should not need to use imsets program afterwards
 +
on outimage.i2i.  You can give numbers outside zdim (ie, -o -1 1000 would insure all
 +
time points are saved regardless of numsets)
 +
  -O # # outimage.i2i:  same as -o, but writes out original voxel values (voxels not in objects set to 0).
 +
  -r: print extra info (to stdout) about each region found.
 +
  -d # #: maximum delta x (or y) (in voxels), max delta z for an allowed match along a track
 +
default=any.
 +
  -u # # # #: units for velocity measurements. x y z voxel size (um) and delta t (in sec).
 +
  -h # file: bin width (um/sec) and file name for velocity histogram (must specify -u). defaults =
 +
                0.010000 (um/sec) and vel_hist.xy
 +
  -M :         also print cube outlines of the maxima in the regions (in rpts format) to stdout.
 +
  -i image.i2i: write out costs used as an image (max truncated to 32767). For diagnostic purposes.
 +
x axis in region at time t, y axis is region at time t+1.
 +
  -V :         verbose
 +
 
 +
examples:
 +
    track -t 660 -n 100 -s 0 5 wt1_r.i2i > tracks.rpts
 +
    dave -4 -I wt1_r.i2i -kptcolor -n 0 -u tracks.rpts
 +
 
 +
    track -t 660 -n 100 -o -1 1000 wt1_obj.i2i -s 0 5 wt1_r.i2i > tracks.rpts
 +
    dave -4 -I wt1_obj.i2i -kptcolor -loadmap random.map -n 0 -u tracks.rpts
 +
 
 +
see also:
 +
trackinfo.pl, modtracks.pl, ~lml/krypton/Arndt/test/run1
 +
 
 +
old source code in ~lml/voxel/Corvera/track
 +
 
 +
source code in ~lml/krypton/track
 +
 +
</nowiki>
 +
===  track_back2  ===
 +
<nowiki>
 +
#/home/lml/krypton/bin/track_back2
 +
error: -readmax MUST be specified on the command line
 +
Takes paths produced by exo4 or exo5 and findpaths_exo4.pl (or 5) and tracks back from the fusion
 +
event as far as possible. It ignores the positions of the path found, just looks backwards for maxima
 +
within the -diststill distance of the fusion event.  A maximum being gone for at least -nomaxtime
 +
time pts defines the start of the path (as when the maximum first disappeared going backwards in time)
 +
Prints info about how long these paths are stationary to stdout.
 +
This would normally be run with the same options as exo4 when it created oldpath.txt
 +
(excluding options which aren't relevant since the fusion time is already found).
 +
 
 +
usage:
 +
track_back2 [options] image.i2i oldpath.txt
 +
options:
 +
-readmax filename: read maxima from filename. This is  a REQUIRED "option"
 +
-diststill # :how far (in x or y) in pixels a maxima can move and still be considered "still", default = 2
 +
-nomaxtime #  :maximum number of consecutive time pts a maximum can be missing along the path, default = 3
 +
-iodsize # :check iod within +/- range pixels., default = 6
 +
-iod min max :object iod (sum of voxels > threshold within iodsize region) must be within these numbers
 +
(inclusive) while a maximum is present. defaults: min = 1, max = 1000000
 +
-size min max :object size (number of voxels > threshold within iodsize region) must be within these numbers
 +
(inclusive) while a maximum is present. defaults: min = 1, max = 100000
 +
-t # :voxels must be > # to be counted as part of object. default = 0
 +
-r filename    :rpts file which specifies a mask outline.
 +
-paths filename : list of which paths in oldpath.txt to examine (as produced by findpaths_exo4
 +
                -stationary_time option). The default is to examine all "saved_paths" in oldpath.txt
 +
-T startt stopt      : only examine these time points (0-indexed, inclusive). may not work.
 +
-debugpath #:   number of path to debug. can only be set once.
 +
-verbose
 +
example:
 +
exo4 -v -r mask.rpts -d 2400 -w 100 -jump 20 -readmax max.rpts
 +
        -iodsize 6 -maxspeed 1 -diststill 1 -fall 11 0.5 -iodrise 0.1 -minpeakval 50
 +
        -minpeakratio 2 2 3 -primedtime 10 100 -check_max 50 image.i2i >& file.out
 +
findpaths_exo4.pl -saved_paths -stationary_time=file.stat -rptsfile=file.rpts -printfusion=5 file.out
 +
addlines file.rpts image.i2i -|play -      examine events, edit file.stat to just keep good events.
 +
track_back2 -r mask.rpts -readmax max.rpts -iodsize 6 -diststill 1 -verbose
 +
          -paths file.stat image.i2i file.out  > file2.stat
 +
 
 +
</nowiki>
 +
===  track_pts  ===
 +
<nowiki>
 +
 
 +
This programs takes a list of initial pts in a 3D image and tracks
 +
them over time.  It writes out the new list.  The image.i2i file should
 +
be a 3D time series.  The format for input.coords is coordinate triplets, one
 +
triplet per line, e.g.:
 +
x1 y1 z1
 +
x2 y2 z2
 +
Output is in a similar format but each point has all its time points printed
 +
in order, along with the pixel value at each location and the average of the 3 by 3 by 3
 +
neighborhood around the point.  Points are separated
 +
by a comment line (# at the beginning of the line)
 +
Tracking is performed by finding the brightest point in the neighborhood of the point's
 +
previous location in the time series.
 +
By default, pixel locations are assumed zero-indexed (first pixel is 0,0,0).
 +
The maximum # of pts allowed is 1000, the time series must be less than 400 in length.
 +
 
 +
Usage: track_pts [options] image.i2i input.coords output.coords
 +
options:
 +
  -x width:  change the default neighborhood halfwidth to search in x (default = 3)
 +
  -y width:  same for y
 +
  -z width:  same for z
 +
  -o: pixel coords in input.pts are one-indexed (like "play").
 +
coords in output.pts should also be one-indexed.
 +
  -m: Use this when the initial coords in input.pts are not exact.
 +
The program will move them to be the location of the brightest nearby voxel.
 +
  -c: perform hill climbing.  Instead of just going to the brightest point
 +
in the neighborhood, go to the brightest point in the neighborhood
 +
which can be gotten to by CONTINUOUSLY going uphill.  Without the -c
 +
small intensity dips (eg, between mitochondria) could be skipped over.
 +
  -i: do not allow a tracked point to move outside the neighborhood of
 +
it's INITIAL position (the default is the neighborhood of it's position
 +
in the previous time frame). note: the -m option is applied
 +
prior to this option (ie, results of -m define the "initial" position).
 +
-b x y z: also include, as the last "point" printed out, the average background
 +
around the point (x,y,z).  The halfwidth of the region can be set with -X,Y,or Z
 +
The coords are 0 indexed unless the -o option is also on the command line.
 +
-X hwidth: change the default halfwidth of the background region around (x,y,z)
 +
default = 5
 +
-Y hwidth: same for y.
 +
-Z hwidth: same for z.
 +
-v: verbose. prints extra info to stderr.
 +
-t tdim: don't read tdim from image header, just use this value.
 +
 
 +
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: coords2pts.awk and coords2xmgr.awk to convert the output.coords into
 +
          either pts format (for addlines or DAVE) or xy format for xmgr.
 +
    coords2pts.awk will be high by 1 if you use the -o option in track_pts.
 +
          trackspots: performs cross-correlation before calling track_pts.
 +
          display_tracks: displays output.coords in DAVE showing intensity of tracks.
 +
 
 +
Souce code in:  /storage/big1/lml/was_invitro/Drummond   
 +
 +
</nowiki>
 +
===  vcspat  ===
 +
<nowiki>
 +
 +
Usage:
 +
  vcspat [options] ascii_output.data mask_image.i2i image.i2i [second.i2i]
 +
Description:
 +
  Complete spatial randomness of punctates in a volume.
 +
Options:
 +
  -c #  : do colocalization instead of complete spatial randomness
 +
          does the random trials by randomizing the points in the second image.
 +
          (use this option with two images, plus it keeps all the points in mask for
 +
          both images)
 +
  -d #  : maximum distance from punctate to examine (default=10.000000)
 +
  -n #  : number of regions to examine (default=100)
 +
          if # = 0, all regions in each object will be examined.
 +
  -m #  : value of region in mask (default=1)
 +
  -r #  : seed for random number generator (defaults to process id).
 +
  -t # #: image number and threshold. Keep points >= to image threshold (default=1 image is 1 or 2).
 +
  -T #  : number of random trials. (default=100)
 +
  -z #  : z weighting factor (default=1.0).
 +
 
 +
note: entire image name (with extension) is required.
 +
note: a - in place of an image name means stdin or stdout.
 +
 
 +
 
 +
</nowiki>
 +
== Statistics ==
 +
===  cluster_distances.pl  ===
 +
<nowiki>
 +
 
 +
Takes output from channel_current2 (after 11/24/09) and pulls out statistics about
 +
mean distance to each BK cluster.  Then produces average stats from all the files
 +
analyzed. Output to stdout.
 +
 
 +
 
 +
usage:
 +
 
 +
  -files:file1:file2:...:filen       which files to analyze. Defaults are files named 2_*.currents in cwd.
 +
  -numBKvsProb       also prints numBK vs prob data suitable for xmgrace
 +
 
 +
 
 +
example:
 +
  (channel_current2  .... > file.channel_current) >& file1.currents
 +
  (channel_current2  .... > file2.channel_current) >& file2.currents
 +
  cluster_distances.pl -numBKvsProb -files=file1.currents:file2.currents > avg_distances.txt
 +
  fgrep -v clusters avg_distances.txt |xmgrace -pipe
 +
 
 +
note: mean distances to clusters are not always increasing (e.g., mean distance to 10th
 +
      cluster could be SMALLER than the mean distance to the 9th cluster).  I think this
 +
      has to do with limiting my maximum distance (see comments in this file).
 +
 
 +
 +
see also:
 +
  channel_current2
 +
  /home/lml/krypton/Zhuge/BKandRyr/analysis6/run12
 +
  /home/lml/krypton/Huang/Kth_pt.m
 +
  p. 637 of Cressie.
 +
 
 +
 +
</nowiki>
 +
===  coloc.pl  ===
 +
<nowiki>
 +
 
 +
calls coloc3way with a bunch of different thresholds. Creates an output file which can be
 +
graphed with VennDiagram.m.
 +
 
 +
coloc.pl im1.i2i im2.i2i im3.i2i  > out.coloc3way
 +
 
 +
options:
 +
-time_vs_thresh just generate a file which shows which times correspond to which thresholds. images can be dummy names.
 +
 
 +
-t1=#:#:# threshold one should go from # to # by #. default = 800:1200:50
 +
-t2=#:#:# threshold two should go from # to # by #. default = 800:1200:50
 +
-t3=#:#:# threshold three should go from # to # by #. default = 2000:4000:200
 +
-numthresh=#1:#2:#3  ignore the third number in the -t1, -t2, and -t3 options (or in the default) and instead calculate a
 +
  threshold step size so that #1 thresholds are applied to im1.i2i (dat image)
 +
  #2 thresholds are applied to im2.i2i (ctx image), #3 thresholds are applied to im3.i2i (rin 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
 +
-verbose
 +
 
 +
example:
 +
 
 +
coloc.pl im1.i2i im2.i2i im3.i2i > coloc.data
 +
coloc.pl -time_vs_thresh im1.i2i im2.i2i im3.i2i > coloc.times
 +
matlab
 +
>> VennDiagram('coloc.data','percent')  # and manually look at coloc.times while doing this to convert times to thresholds.
 +
 
 +
see also:
 +
~/krypton/packages/fiji/Fiji.app/plugins/jacob_.jar  - more traditional colocalization measures
 +
coloc_tseries2
 +
colocalizeL
 +
 
 +
 +
</nowiki>
 +
===  probcircle.pl  ===
 +
<nowiki>
 +
  given a sphere of diameter D, what is the prob of oberving a disk of radius r when a random plane intersects it?
 +
  prints to stdout: r  prob(r) 1/prob(r)
 +
 
 +
  usage:
 +
      probcircle.pl [options]
 +
 
 +
  options:
 +
-D=# default = 1
 +
-just_prob don't print the third column
 +
 
 +
  examples:
 +
      probcircle.pl | xmgrace -free -pipe -nxy -
 +
 
 +
  see also: p. 249 stereology_book.pdf
 +
    /home/lml/krypton/packages/fiji/stereology_lml.template
 +
    /home/lml/krypton/Corvera/Raz/stereology/plot_results.pl
 +
    /home/lml/krypton/facil/cross_sections_of_sphere
 +
 
 +
 +
</nowiki>
 +
===  compare2dist  ===
 +
<nowiki>
 +
 
 +
This program calculates whether two amplitude distributions are the same.
 +
It was written to examine Rhonghua's STOCS data to determine whether the increase
 +
in observed STOC frequency could be explained by an increase in STOC amplitude
 +
(since then more events above threshold would be observed). 
 +
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
 +
by a range of shifts (-s option) and compared with datafile1.
 +
This routine also compares the temporal interarrival time distribution of each datafile with
 +
that predicted by a poisson process and with the other datafile; the temporal calculations
 +
ignore all missing data issues and shifting issues for now.
 +
 
 +
This program reads data in the form:
 +
    time calcium prior_baseline post_baseline amplitude
 +
      where the values are
 +
      time:            time of STOC
 +
      calcium:        SR calcium level
 +
      prior_baseline:  amplitude just prior to STOC
 +
      post_baseline:  amplitude just after STOC
 +
      amplitude:      amplitude amplitude of STOC (not relative to baseline)
 +
Data is expected to already be sorted by time (smallest to largest).
 +
comment lines must begin with a #
 +
 
 +
Usage: compare2dist [options] datafile1 datafile2
 +
options:
 +
    -t #: only include data with an amplitude > #. The default
 +
is to assume a 0 threshold. If you have acquired the data
 +
using some thresholding criterium (eg, only peaks above
 +
10picoamps are counted) then you should provide that number
 +
here, even if all your data is above this (ie, you've applied
 +
the threshold in your identification phase). This is because
 +
we need to know it when we shift amplitudes of the second
 +
distribution to see if it could match the first distribution.
 +
    -b: subtract average baseline from amplitude prior to use (ie, prior
 +
to any thresholding or intensity shifting of data).
 +
    -s delta max: shift datafile2 amplitudes down by a maximum of max, in
 +
increments of delta, to see if it will then match datafile1.
 +
  -p #: our guess of the percentage of data missing from datafile2 because it was
 +
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 true.  But 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
 +
This code is in ~lml/vision/Rhonghua/STOCS
 +
#/home/lml/krypton/bin/compare2dist
 +
 
 +
</nowiki>
 +
===  compare2gaussian  ===
 +
<nowiki>
 +
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:
 +
      -t #: only include data with an amplitude > #. The default is to include all data.
 +
  -g # amp1 mean1 sd1 ... :
 +
The Gaussian mixture model the data should be compared against (using a KS statistic).
 +
# is the number of Gaussians, this is followed by the amplitude, mean, and sd of
 +
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.
 +
  -T: test. runs through x = 0 to 10 and prints out cumulative prob. exits.
 +
 
 +
See Also: fitgaussians2, fit2gaussians, fit3gaussians
 +
 
 +
Source code is in ~lml/krypton/Lefkowitz
 +
#/home/lml/krypton/bin/compare2gaussian
 +
 
 +
</nowiki>
 +
===  compare_dist2  ===
 +
<nowiki>
 +
 
 +
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).
 +
Comment lines must begin with a #
 +
Floating pt numbers are truncated to integers for bin number (max bin number = 50000).
 +
 
 +
Usage: compare_dist2 [options] datafile1 datafile2
 +
options:
 +
  -k perform K-S test instead (I'm not certain the numbins I use to calculate this is correct).
 +
  -a also print the histograms produced
 +
  -b also print the normalized histograms (total count datafile2 scaled to the same count as in datafile1,
 +
  bins with 0 removed), this is only done if -k not specified (ie, only if performing chi-square test).
 +
  -c also print the cumulative prob distributions (only done if -k also specified)
 +
  -r # #: only analyze sizes within the specified range (inclusive)
 +
  -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 #
 +
  -z: for chi-square keep zero entry bins (chi square only correct if this option is NOT used)
 +
so why is this option here?  if you just really want to use this program to do
 +
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.
 +
  -v verbose
 +
  -V very verbose
 +
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
 +
This code is in /home/lml/krypton/Zhuge/Ryr_clusters/
 +
#/home/lml/krypton/bin/compare_dist2
 +
 
 +
</nowiki>
 +
===  correlationL  ===
 +
<nowiki>
 +
/home/lml/krypton/bin/correlationL
 +
 
 +
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
 +
(default = 512).  The intensity at each pixel in the output
 +
image is the number of (image1,image2) voxels with that particular
 +
intensity combination.
 +
The intent is to be able to look at the output image and get a sense
 +
for whether there is a correlation between intensities
 +
in the two images.  If so, perhaps a least squares line
 +
fit should be done to see how well one images correlates with the
 +
other, or -s option can be specified.
 +
The minimum, maximum, and scale factors are printed to stdout.
 +
Version 1.1
 +
 
 +
Usage: correlation [options] im1.i2i im2.i2i out.i2i
 +
options:
 +
  -d xdim ydim: output dimensions of new image
 +
(default = 512,512).
 +
  -S im1scale im2scale: scale intensities with these scale factors. newval = (intens-min_intens)*scale
 +
  -B b1 b2:    force min_intens (black level) to specified value.  newval1 = (intens-b1)*scale1
 +
  -i val1 val2: Ignore any voxels in image1 <= val1 and
 +
any voxels in image2 <= val2.
 +
 
 +
  -h val1 val2: Ignore any voxels in image1 >= val1 and
 +
any voxels in image2 >= val2.
 +
 
 +
  -r: instead of intensities, use the rank
 +
order of the intensities.
 +
  -a: automatically calculate the size of the
 +
output image. attempts to make the scale
 +
factor = 1.
 +
  -b: keep the xdim and ydim scale factors the same.
 +
  -s: calculate Spearman rank-order correlation
 +
coefficients. print results to stdout.
 +
  -z zslice:    only examine the specified z slice (the first
 +
slice is considered slice 0).
 +
note: entire image name is NOT required.
 +
note: a - in place of an image name means stdin or stdout.
 +
 
 +
examples:
 +
    # to apply this to a set of 3D images, using the same scales and size images for easy comparison
 +
correlationL -S s1 s2 -d 512 512 -B 0 0 image1.i2i corr1.i2i    (and same for other images)
 +
 +
</nowiki>
 +
===  create_imagesL  ===
 +
<nowiki>
 +
 
 +
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
 +
(as originally specified to "many_overlaps") which overlap with
 +
voxels above threshold in image2. A 100 in the output image = 100 percent.
 +
The probability of observing as much (or more) overlap as we did due to
 +
random chance is the prob.i2i image.  Probabilities are mulitplied by 100.
 +
 
 +
Position along the y-axis (vertical axis) of the image, corresponds to
 +
thresholds for image2. The x-axis represents image1 thresholds.  The