**Code Depository of Some of My Publications**

I collected codes for some of our publications.
These are mostly Matlab scripts. Use them in any way
you want! *Please cite our related papers* if you use them in your work.
Thanks!

**[People Counting]** H.Foroughi,
N.Ray, *H.Zhang**, ″Robust
people counting using sparse representation and random projection,″
Pattern Recognition*, Special Issue on Discriminative Feature Learning from
Big Data for Visual Recognition, ISSN 0031-3203, March 2015.

Download code and examples from my PhD student Homa's page.

**[Image Alignment] **Alignment or registration of time-sequenced
microscopy images is a necessary step in many image analysis tasks. Our minimum
spanning tree-based course image alignment (**MISTICA**) has demonstrated
great promise.

I have written these programs (plugins) for ImageJ.
Dependencies on packages are described inside the plugins.

**... [2D Coarse Alignment]** Please cite **both** the papers listed below, when you are using our
code:

o S. McArdle, ST Acton, K. Ley, N. Ray, ″Registering
Sequences of In Vivo Microscopy Images for Cell Tracking Using Dynamic
Programming and Minimum Spanning Trees,″ *2014* *IEEE International
Conference on Image Processing (ICIP)*, pp.3547,3551, 27-30 Oct. 2014.

o N. Ray, S. McArdle, S.T.
Acton, K, Ley, ″MISTICA: Minimum Spanning Tree-based Coarse Image
Alignment for Microscopy Image Sequences,″ accepted at *IEEE Journal of Biomedical and Health
Informatics*, 2015.

A sample 2D dataset
(6.2MB) is provided here. Open this
sequence in ImageJ as File>Import>Image
Sequence ... For this image sequence Dr. Ley's team has collected 3
images per time point. So, the first step is to apply our Frame Selection plugin with
default user input parameters. This step will leave us with one third as many
images in the sequence. Frame selection is computed by dynamic programming. In
the next step, apply our MISTICA plugin
for 2D alignment.

A Matlab
implementation of MISTICA with only translational motion is provided here. You need to create an
output image folder (Images_reg) to run this script.
Another version of Matlab script here includes rigid body
transformation using SIFT implementation of VLFeat.

**... [Sample Results]** Some
comparative results can be downloaded from this link,
where the video produced by MISTICA appears as Cell_noisy_AMST200.avi.

**... [3D Coarse Alignment] **Please cite **both** the papers
listed below, when you are using our code:

o S. McArdle, G. Chodaczek, N. Ray, K. Ley, ″Intravital live cell triggered imaging system (ILTIS) reveals
monocyte patrolling and macrophage migration in atherosclerotic arteries,″ *Journal
of Biomed Opt* 2015 Feb;20(2):26005.

o N. Ray, S. McArdle, S.T.
Acton, K, Ley, ″MISTICA: Minimum Spanning Tree-based Coarse Image
Alignment for Microscopy Image Sequences,″ accepted at *IEEE Journal of Biomedical and Health
Informatics*, 2015.

Download a sample 3D
dataset (133MB) from here.
Open this sequence in ImageJ as
File>Import>Image Sequence
.... Next, do Image>Hyperstacks>Stack
to Hyperstack.... A dialogue box will appear. In the
dialogue box, uncheck ″Convert
RGB to 3 Channel Hyperstack″ option. Input Slices(z)
as 102 and Frames(t) as 10. Click OK.

Just like the sample
2D sequence, for this 3D sequence 3 images were collected at each time point.
So, run our Frame Selection
plugin with default user input parameters on this hyperstack
to make this dataset ready for the alignment step. Frame selection step will
retain only one third as many images.

Now, you have two
options. The **first option** is to convert the hyperstack
back to a stack by doing Image>Hyperstacks>Hyperstack to Stack. Then apply our 2D stack alignment plugin with
″Graph width″ parameter as total number of images in this
2D sequence. You must choose ″Method″ parameter as
″Approximate″. This will run our MISTICA 2D alignment
plugin on a complete graph and will produce a stack of registered images. You
will convert this registered stack to hyperstack and
apply our hyperstack alignment plugin. You will want to keep the
default parameter 0 (zero) for the ″Intra-stack graph width″. With this zero intra-stack (i.e., within stack) graph width, this plugin
simply aligns the maximum z projections for each stack and applies those
transformations to each stack.

With the **second
option** proceed as follows. Run our hyperstack
alignment plugin with ″Intra-stack graph width″ as 1. For this 3D alignment, first each z stack is individually aligned
by the MISTICA algorithm. Then, maximum z projection of each z stack is
constructed. This step provides us with a 2D sequence of maximum z projections
where we again apply MISTICA. Transformations computed on the z projections are
applied to the individual stacks.

**... [3D Deformable Alignment]** Coming
up!

**[GICOV Reformulation]** N. Ray, S.T. Acton, H. Zhang, ″Seeing
through clutter: Snake computation with dynamic programming for particle
segmentation″ *ICPR 2012*.

Reformulation of GICOV criterion in DP snake setting to segment ″star shaped″ objects. Download code and a test image from here.

**[Document Binarization]** J. Shi, N. Ray and H Zhang, "Shape based
local thresholding for binarization
of document images" *Pattern Recognition Letters*.

The code is written partly by Jichuan Shi and partly by me. It is a user interactive document binarization technique. The user chooses a small portion of the text on the document. For a sample input and output see this. Our Matlab script and a sample document image. While running our script, keep the .m file and the sample document image in the same folder.

**[Variational
Image Thresholding] **B. Saha and N. Ray, "Image thresholding
by variational minimax optimization," *Pattern
Recognition*.

Download the zipped file, unzip into a folder and run the Matlab script.

**[Brain Tumor Detection]** B. Saha, N. Ray, R.
Greiner, A. Murtha, H. Zhang, "Quick detection of brain tumors and edemas:
A bounding box method using symmetry," *Computerized Medical Imaging and
Graphics*.

Download the zipped file and unzip into a folder. While running the Matlab script, play with the sample MR images.

**[Optical Flow]** N. Ray, "Computation of fluid and particle
motion from time sequenced image pair: a global outlier identification
approach," *IEEE Transactions on Image Processing*, vol.20, no.10,
pp.2925-2936, 2011.

Download the zipped file that unzips into a Matlab script and a sample image pair.

**[Spinal Cord Segmentation]** D.P. Mukherjee, I. Cheng, N. Ray, V. Mushahwar, A. Basu,
"Automatic segmentation of spinal cord MRI using symmetric boundary
tracing," *IEEE Trans. on Information Technology in Biomedicine*,
vol.14, pp.1275-1278, 2010.

Download zipped file. This script uses a special Matlab toolbox (MatlabBGL) that you need to download. My code creates barriers and uses shortest path active contour for automatic segmentation of the sample image, also included in the zipped file.

**[Droplet Tracking]** Metal droplet tracking in welding applications
-- please see my page for the software and detailed instructions.

**[Image Smoothing]** N. Ray, "Median filter with absolute value
norm spatial regularization," *IEEE ICASSP 2011*, Prague, Czech
Republic.

Download my Matlab script . This script uses a special network simplex implementation from TOMLAB / CPLEX.

**[GICOV] **G.
Dong, N. Ray and S.T. Acton, "Intravital
leukocyte detection using the gradient inverse coefficient of variation," *IEEE
Transactions on Medical Imaging*, Vol.24, no.7, pp. 910-924, July 2005.

This code is partly written by Gang Dong and partly by me. Download our Matlab script and a sample image, put them in the same folder and run the script. The code can also be run in a user interactive way: look at lines 11-18 in the script.

**[Merging Snakes] **N.
Ray, S.T. Acton, T. Altes, E.E. de Lange and J.R. Brookeman, ″Merging parametric active contours within
homogeneous image regions for MRI-based lung segmentation,″ *IEEE
Trans. Medical Imaging*, vol.22, no. 1, pp.189-199, 2003.

This Matlab code illustrates merging of snakes inside lung cavities. An example image used in the paper is provided. Run the .m file ″Automated_lungseg.″

**Some Utilities I Wrote**

**[1]** User interactive shortest path active contour -
download the zipped file -
unzip into a folder. While running the script, you will be asked to input two
points on the image. A shorest
path snake will be drawn between these two points. This script uses MatlabBGL that you need to download.

**[2]** A basic active contour / snake implementation in Matlab
that reduces the bandwidth of the coefficient matrix, so we can make use of
O(n) linear equation solver (Thomas algorithm).