(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 194978, 4444] NotebookOptionsPosition[ 192768, 4367] NotebookOutlinePosition[ 193262, 4386] CellTagsIndexPosition[ 193219, 4383] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[StyleBox["Dual Channel Single Molecule Particle Tracking", FontSize->48]], "Title", CellChangeTimes->{{3.4649572053413725`*^9, 3.4649572224389725`*^9}, 3.4759410985666866`*^9, 3.5003871088734264`*^9, 3.552331654742819*^9, { 3.589827168818861*^9, 3.589827175640251*^9}, {3.5915314272220697`*^9, 3.5915314313716764`*^9}}, FontSize->72], Cell[CellGroupData[{ Cell["Read Me", "Section", CellChangeTimes->{{3.589827449199898*^9, 3.589827451755044*^9}, { 3.5915314476425047`*^9, 3.5915314503881097`*^9}, {3.591531528372646*^9, 3.5915315304162493`*^9}}], Cell[TextData[{ "This code contained in \ \[OpenCurlyDoubleQuote]SingleMoleculeTracking_FRET.nb\[CloseCurlyDoubleQuote] \ converts a movie of diffraction-limited fluorescent objects into a series of \ molecular trajectories. The data input is a series of TIFF images (contained \ in a single directory for each movie), where light from a donor channel has \ been projected onto the left hand side of the image and light from the \ acceptor channel has been projected onto the right hand side of the image. \ This code was written in ", StyleBox["Mathematica", FontSlant->"Italic"], " 8 and can run on versions 8 or 9. The associated library file, \ \[OpenCurlyDoubleQuote]ParticleTrackingFRET.m\[CloseCurlyDoubleQuote] is also \ required and the directory that contains this file must be specified in the \ code below (as noted by comments) based on the local directory structure. \ Comments are provided throughout the notebook using the notation \ \[OpenCurlyDoubleQuote](*comment*)\[CloseCurlyDoubleQuote].\n\nThe tracking \ algorithm procedes in 4 \[OpenCurlyDoubleQuote]Steps\[CloseCurlyDoubleQuote] \ that are further divided into sub-tasks contained in ", StyleBox["Mathematica", FontSlant->"Italic"], " evaluation cells. These steps and sub-tasks should be followed \ sequentially, from top to bottom, where each cell can be evaluated by \ clicking in the cell and using the \[OpenCurlyDoubleQuote]Enter\ \[CloseCurlyDoubleQuote] function on the keyboard, which is separate from the \ \[OpenCurlyDoubleQuote]Return\[CloseCurlyDoubleQuote] function (press \ shift-Enter or shift-Return on most keyboards). To open each Step and \ sub-task, double click on the bracket for the desired item on the right in \ the ", StyleBox["Mathematica", FontSlant->"Italic"], " environment, read the comments, change necessary parameters and file \ paths, and then evaluate the cells. Using the \[OpenCurlyDoubleQuote]Quit \ Kernel\[CloseCurlyDoubleQuote] function is recommended after each \ \[OpenCurlyDoubleQuote]Step\[CloseCurlyDoubleQuote] in order to clear memory \ of unnecessary information. Each \[OpenCurlyDoubleQuote]Step\ \[CloseCurlyDoubleQuote] begins by loading the relevant output of the \ previous \[OpenCurlyDoubleQuote]Step\[CloseCurlyDoubleQuote]. It is also \ necessary to enable Dynamic Updating (often the default setting in ", StyleBox["Mathematica", FontSlant->"Italic"], ") in Step 1." }], "Text", CellChangeTimes->{{3.591531535408258*^9, 3.5915315515230865`*^9}, { 3.591534868385269*^9, 3.5915349844338713`*^9}, {3.591535398567794*^9, 3.591535627357793*^9}, {3.5915357066995316`*^9, 3.59153587822183*^9}, { 3.5915359105450864`*^9, 3.59153622245203*^9}, {3.5915394556668673`*^9, 3.59153960038832*^9}, {3.5915396712592435`*^9, 3.591539709791311*^9}, { 3.591539740726165*^9, 3.591539742707368*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Step 1: Image Import and Processing\ \>", "Section", CellChangeTimes->{{3.589827449199898*^9, 3.589827451755044*^9}}], Cell[CellGroupData[{ Cell["Set File Paths and Directories", "Subsection", CellChangeTimes->{{3.466447278286237*^9, 3.4664472878392367`*^9}, { 3.467563874208043*^9, 3.4675638855820436`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{ "Set", " ", "directories", " ", "for", " ", "the", " ", "input", " ", "data"}], ",", " ", RowBox[{"which", " ", "should", " ", "be", " ", "TIFF", " ", RowBox[{"images", ".", " ", "Each"}], " ", "directory", " ", "should", " ", "be", " ", "for", " ", "a", " ", "separate", " ", RowBox[{"movie", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"DirectoryList", " ", "=", " ", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"\ "}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Set", " ", "directory", " ", "for", " ", "the", " ", "output", " ", RowBox[{"data", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ "DataDirectory", " ", "=", " ", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Change", " ", "directory", " ", "for", " ", "the", " ", "ParticleTrackingFRET", " ", "library", " ", "file", " ", "in", " ", "the", " ", "line", " ", RowBox[{"below", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"Get", "[", RowBox[{"\"\\"", ",", " ", RowBox[{ "Path", " ", "->", " ", "\"\\""}]}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"NumberOfMovies", " ", "=", " ", RowBox[{"Length", "[", "DirectoryList", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MovieFilesTemp", " ", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Drop", "[", RowBox[{ RowBox[{ RowBox[{"SetDirectory", "[", RowBox[{"DirectoryList", "[", RowBox[{"[", "DirectoryIndex", "]"}], "]"}], "]"}], ";", " ", RowBox[{"FileNames", "[", "]"}]}], ",", RowBox[{"Flatten", "[", RowBox[{"Position", "[", RowBox[{ RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"#", ",", "\"\<\>\""}], "]"}], "&"}], ",", " ", RowBox[{ RowBox[{"SetDirectory", "[", RowBox[{"DirectoryList", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], ";", " ", RowBox[{"FileNames", "[", "]"}]}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], ",", "\"\<.\>\""}], "]"}], "]"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"DirectoryIndex", ",", " ", "1", ",", " ", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MovieFiles", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"StringJoin", "[", RowBox[{ RowBox[{"DirectoryList", "[", RowBox[{"[", "DirectoryIndex", "]"}], "]"}], ",", " ", "#"}], "]"}], " ", "&"}], ",", " ", RowBox[{"MovieFilesTemp", "[", RowBox[{"[", "DirectoryIndex", "]"}], "]"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"DirectoryIndex", ",", " ", "1", ",", " ", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DataFilePrefix", " ", "=", " ", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"#", ",", " ", RowBox[{"{", RowBox[{"\"\<\\\\\>\"", ",", " ", "\"\<.\>\""}], "}"}]}], "]"}], "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}], "&"}], ",", " ", "DirectoryList"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MovieLengths", " ", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Length", "[", RowBox[{"MovieFiles", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", " ", "1", ",", " ", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.501448806519967*^9, 3.501448808455078*^9}, { 3.501449628371331*^9, 3.5014496503517694`*^9}, {3.558892993625326*^9, 3.5588929961369305`*^9}, {3.589826296615974*^9, 3.5898263560003705`*^9}, { 3.5898263974337406`*^9, 3.5898264869358597`*^9}, {3.5898268419821672`*^9, 3.5898268641264334`*^9}, {3.5898271888440065`*^9, 3.589827244928214*^9}, 3.5915321798297815`*^9, {3.5915349550122204`*^9, 3.591534961345832*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["Identify Offset Parameters", "Subsection", CellChangeTimes->{{3.498242304566942*^9, 3.4982423047819157`*^9}, { 3.498242338717662*^9, 3.4982423467679453`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "The", " ", "parameter", " ", "\"\\"", " ", "is", " ", "the", " ", "frame", " ", "in", " ", "which", " ", "alignment", " ", "features", " ", "are", " ", "most", " ", RowBox[{"prominent", ".", " ", "Usually"}], " ", "this", " ", "is", " ", "the", " ", "first", " ", "frame", " ", "but", " ", "can", " ", "be", " ", "chosen", " ", RowBox[{"otherwise", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"alignmentframe", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RETImages", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"Import", "[", RowBox[{"#", "[", RowBox[{"[", "alignmentframe", "]"}], "]"}], "]"}], "&"}], ",", "MovieFiles"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"PixelWidth", ",", "PixelLength"}], "}"}], "=", RowBox[{"Transpose", "[", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"ImageDimensions", "[", "#", "]"}], "&"}], ",", "RETImages"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ImageDataTemp", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"ImageData", "[", RowBox[{"#", ",", "\"\\""}], "]"}], "&"}], ",", "RETImages"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "The", " ", "parameters", " ", "Lsplit", " ", "and", " ", "Rsplit", " ", "crop", " ", "the", " ", "images", " ", "before", " ", "alignment", " ", "in", " ", "order", " ", "to", " ", "ignore", " ", "any", " ", "overlap", " ", "of", " ", "light", " ", "from", " ", "the", " ", "two", " ", "channels", " ", "on", " ", "the", " ", RowBox[{"EMCCD", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Lsplit", "=", "250"}], ";", RowBox[{"Rsplit", "=", "260"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"LHSbegin", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{"1", "&"}], ",", "ImageDataTemp"}], "]"}]}], ";", RowBox[{"LHSend", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{"Lsplit", "&"}], ",", "ImageDataTemp"}], "]"}]}], ";", RowBox[{"LHSwidth", "=", RowBox[{"LHSend", "-", "LHSbegin", "+", RowBox[{"Map", "[", RowBox[{ RowBox[{"1", "&"}], ",", "LHSbegin"}], "]"}]}]}], ";", RowBox[{"RHSstart", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{"Rsplit", "&"}], ",", "ImageDataTemp"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Note", " ", "that", " ", "this", " ", "code", " ", "was", " ", "written", " ", "for", " ", "a", " ", "512", "x512", " ", RowBox[{"image", ".", " ", "Slight"}], " ", "modifications", " ", "may", " ", "be", " ", "necessary", " ", "for", " ", "other", " ", "image", " ", RowBox[{"sizes", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RHSend", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{"511", "&"}], ",", "ImageDataTemp"}], "]"}]}], ";", RowBox[{"RHSwidth", "=", RowBox[{"RHSend", "-", "RHSstart", "+", RowBox[{"Map", "[", RowBox[{ RowBox[{"1", "&"}], ",", "RHSstart"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"LHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Take", "[", RowBox[{ RowBox[{"ImageDataTemp", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "All", ",", RowBox[{"{", RowBox[{ RowBox[{"LHSbegin", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"LHSend", "[", RowBox[{"[", "i", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "ImageDataTemp", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{"RHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Take", "[", RowBox[{ RowBox[{"ImageDataTemp", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "All", ",", RowBox[{"{", RowBox[{ RowBox[{"RHSstart", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"RHSend", "[", RowBox[{"[", "i", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "ImageDataTemp", "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Searches", " ", "an", " ", "area", " ", "10", "w", " ", "x", " ", "10", "h", " ", SuperscriptBox["pixels", "2"], " ", "for", " ", "the", " ", "offset", " ", "coordinates", " ", "that", " ", "produce", " ", "the", " ", "best", " ", "alignment", " ", "between", " ", "the", " ", "two", " ", RowBox[{"channels", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"w", "=", "10"}], ";", RowBox[{"h", "=", "10"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"totals", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"{", "}"}], "&"}], ",", "ImageDataTemp"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", RowBox[{"Length", "[", "ImageDataTemp", "]"}]}], ",", RowBox[{"i", "++"}], ",", RowBox[{"For", "[", RowBox[{ RowBox[{"offsetY", "=", RowBox[{"-", "h"}]}], ",", RowBox[{"offsetY", "\[LessEqual]", "h"}], ",", RowBox[{"offsetY", "++"}], ",", RowBox[{"For", "[", RowBox[{ RowBox[{"offsetX", "=", RowBox[{"-", "w"}]}], ",", RowBox[{"offsetX", "\[LessEqual]", "w"}], ",", RowBox[{"offsetX", "++"}], ",", RowBox[{ RowBox[{"Xstart", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"offsetX", "<", "0"}], ",", "1", ",", RowBox[{"1", "+", "offsetX"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Ystart", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"offsetY", "<", "0"}], ",", "1", ",", RowBox[{"1", "+", "offsetY"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Xend", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"offsetX", "<", "0"}], ",", RowBox[{ RowBox[{"LHSend", "[", RowBox[{"[", "i", "]"}], "]"}], "+", "offsetX"}], ",", RowBox[{"LHSend", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Yend", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"offsetY", "<", "0"}], ",", RowBox[{ RowBox[{"PixelLength", "[", RowBox[{"[", "i", "]"}], "]"}], "+", "offsetY"}], ",", RowBox[{"PixelLength", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RHSxStart", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"offsetX", "<", "0"}], ",", RowBox[{"1", "-", "offsetX"}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RHSyStart", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"offsetY", "<", "0"}], ",", RowBox[{"1", "-", "offsetY"}], ",", "1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"width", "=", RowBox[{"Min", "[", RowBox[{ RowBox[{"Xend", "-", RowBox[{"(", RowBox[{"Xstart", "-", "1"}], ")"}]}], ",", RowBox[{ RowBox[{"RHSwidth", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"(", RowBox[{"RHSxStart", "-", "1"}], ")"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"height", "=", RowBox[{"Min", "[", RowBox[{ RowBox[{"Yend", "-", RowBox[{"(", RowBox[{"Ystart", "-", "1"}], ")"}]}], ",", RowBox[{ RowBox[{"PixelLength", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"(", RowBox[{"RHSyStart", "-", "1"}], ")"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"LHSoffset", "=", RowBox[{"Take", "[", RowBox[{ RowBox[{"LHS", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"Ystart", ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"Yend", "-", "Ystart", "+", "1"}], ")"}], ">", "height"}], ",", RowBox[{"Ystart", "+", "height", "-", "1"}], ",", "Yend"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"Xstart", ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"Xend", "-", "Xstart", "+", "1"}], ")"}], ">", "width"}], ",", RowBox[{"Xstart", "+", "width", "-", "1"}], ",", "Xend"}], "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"RHSoffset", "=", RowBox[{"Take", "[", RowBox[{ RowBox[{"RHS", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"RHSyStart", ",", RowBox[{"RHSyStart", "+", "height", "-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"RHSxStart", ",", RowBox[{"RHSxStart", "+", "width", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"convolve", "=", RowBox[{"LHSoffset", "*", "RHSoffset"}]}], ";", "\[IndentingNewLine]", RowBox[{"meanLHS", "=", RowBox[{"Mean", "[", RowBox[{"Flatten", "[", "LHSoffset", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"meanRHS", "=", RowBox[{"Mean", "[", RowBox[{"Flatten", "[", "RHSoffset", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"total", "=", RowBox[{ RowBox[{"Total", "[", RowBox[{"Flatten", "[", "convolve", "]"}], "]"}], "/", RowBox[{"(", RowBox[{"meanLHS", "*", "meanRHS", "*", RowBox[{"Length", "[", "convolve", "]"}], "*", RowBox[{"Length", "[", RowBox[{"Transpose", "[", "convolve", "]"}], "]"}]}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{ RowBox[{"totals", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"offsetX", ",", "offsetY", ",", "total"}], "}"}]}], "]"}], ";"}]}], "]"}]}], "]"}]}], "]"}], "\[IndentingNewLine]", RowBox[{"Clear", "[", "i", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"max", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Position", "[", RowBox[{"#", ",", RowBox[{"Max", "[", RowBox[{"#", "[", RowBox[{"[", RowBox[{"All", ",", "3"}], "]"}], "]"}], "]"}]}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "&"}], ",", "totals"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"OffsetCoordinates", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"totals", "[", RowBox[{"[", RowBox[{"i", ",", RowBox[{"max", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"1", ";;", "2"}]}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "totals", "]"}]}], "}"}]}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.466784250505952*^9, 3.466784386347477*^9}, { 3.466784422941058*^9, 3.46678442335456*^9}, {3.46678449879288*^9, 3.4667845339833117`*^9}, {3.46678458983743*^9, 3.466784683002742*^9}, { 3.4667847933108253`*^9, 3.4667847959423227`*^9}, {3.466784867693468*^9, 3.466784904234068*^9}, {3.466785167377569*^9, 3.466785179209148*^9}, { 3.466785273196101*^9, 3.466785280677693*^9}, {3.4667856328129797`*^9, 3.466785658248811*^9}, {3.46678570445581*^9, 3.4667857629256563`*^9}, { 3.466785794862892*^9, 3.466785805612171*^9}, {3.466785843890299*^9, 3.466785844394595*^9}, {3.466785883833096*^9, 3.466785965150795*^9}, { 3.466786145202056*^9, 3.466786145367893*^9}, {3.466786233028223*^9, 3.4667862695148277`*^9}, {3.4667863276322927`*^9, 3.466786327672063*^9}, { 3.466786383758935*^9, 3.466786383862784*^9}, {3.466786433828874*^9, 3.4667864343488607`*^9}, {3.466786471675404*^9, 3.4667865045700893`*^9}, { 3.466786591470059*^9, 3.466786605716963*^9}, {3.4667866500487328`*^9, 3.466786737057926*^9}, {3.466786802046986*^9, 3.466786834804008*^9}, { 3.466786866433929*^9, 3.4667868709307947`*^9}, {3.466787937755237*^9, 3.466787942255547*^9}, {3.4667880086694803`*^9, 3.466788012236844*^9}, 3.466788100398559*^9, {3.4667882098472223`*^9, 3.466788210047073*^9}, { 3.466788255015234*^9, 3.4667883139437113`*^9}, {3.466788350388563*^9, 3.4667884963165827`*^9}, {3.4667885405816307`*^9, 3.466788547627859*^9}, { 3.466788589853128*^9, 3.466788611098295*^9}, {3.466788728959547*^9, 3.466788813211096*^9}, {3.466788899582631*^9, 3.466788899661454*^9}, { 3.466789011579257*^9, 3.466789032136559*^9}, {3.466789415290256*^9, 3.466789491079028*^9}, {3.466789532791965*^9, 3.466789542899246*^9}, { 3.466789877631764*^9, 3.466789897584939*^9}, {3.46678995549553*^9, 3.466789997534068*^9}, {3.466790037565476*^9, 3.466790065047101*^9}, { 3.466790105199155*^9, 3.466790128194206*^9}, {3.466790164819304*^9, 3.466790189735426*^9}, {3.466790408029681*^9, 3.4667904616862307`*^9}, { 3.466790492861624*^9, 3.466790602523332*^9}, {3.466790717235406*^9, 3.466790753408146*^9}, {3.4667907861065187`*^9, 3.4667907926071*^9}, { 3.466790872600445*^9, 3.466790898402499*^9}, {3.4667909926939898`*^9, 3.46679101030896*^9}, {3.466791052621005*^9, 3.4667910563726387`*^9}, { 3.4667912187957783`*^9, 3.466791438018691*^9}, {3.466791503369226*^9, 3.466791563413651*^9}, {3.466791596838623*^9, 3.466791613102586*^9}, { 3.466791703236766*^9, 3.466791731366992*^9}, {3.4668244020738564`*^9, 3.466824418465476*^9}, {3.466824737975375*^9, 3.466824811379973*^9}, { 3.466947988280753*^9, 3.46694801462564*^9}, {3.46708405255873*^9, 3.467084054648262*^9}, {3.4770578436357365`*^9, 3.4770578872232294`*^9}, { 3.477063404027491*^9, 3.477063404479892*^9}, {3.477063975565695*^9, 3.4770639939893274`*^9}, {3.4770645084158306`*^9, 3.477064533625475*^9}, { 3.4770676405075107`*^9, 3.4770676752019715`*^9}, {3.47706781090661*^9, 3.477067813090614*^9}, {3.4770688934313116`*^9, 3.4770689464402046`*^9}, 3.47706910293968*^9, {3.477263506719926*^9, 3.4772635111661797`*^9}, { 3.4772635463871946`*^9, 3.4772635467552156`*^9}, {3.4772637340049367`*^9, 3.477263734488538*^9}, {3.477263806981865*^9, 3.4772638092906685`*^9}, { 3.477264389502488*^9, 3.477264389580488*^9}, {3.4776991104314957`*^9, 3.477699111746098*^9}, {3.477699161290759*^9, 3.477699161851623*^9}, { 3.477699192050642*^9, 3.4776991934459457`*^9}, {3.477699254814218*^9, 3.477699255313196*^9}, {3.47770380366117*^9, 3.477703806454628*^9}, { 3.477705175602187*^9, 3.4777051793000937`*^9}, {3.498242891019261*^9, 3.498242908681007*^9}, {3.498243001622655*^9, 3.4982430759470387`*^9}, { 3.498243184303503*^9, 3.4982431916818457`*^9}, {3.4982432433642483`*^9, 3.498243279676791*^9}, {3.498243367957407*^9, 3.498243400345724*^9}, { 3.498243453042058*^9, 3.49824358807406*^9}, {3.4982436587527847`*^9, 3.498243660393167*^9}, {3.4982437525910463`*^9, 3.498243808068234*^9}, { 3.49824386109312*^9, 3.498243864558229*^9}, 3.4982440956643057`*^9, { 3.498244167047542*^9, 3.4982441736156607`*^9}, {3.4982456491399937`*^9, 3.498245654561562*^9}, {3.498245718327293*^9, 3.498245732209004*^9}, { 3.5003914419092207`*^9, 3.500391453999242*^9}, {3.5003914983969193`*^9, 3.50039153839539*^9}, {3.50074426039342*^9, 3.500744264153027*^9}, { 3.500744535031903*^9, 3.500744547839525*^9}, {3.5007447203758287`*^9, 3.50074472163943*^9}, 3.5007454972387934`*^9, {3.5007456369370384`*^9, 3.5007456484342585`*^9}, {3.5007457641084623`*^9, 3.50074576875727*^9}, 3.516463498929655*^9, 3.51646355867776*^9, {3.5164636916835938`*^9, 3.516463691792794*^9}, {3.5164637341468687`*^9, 3.5164637341936684`*^9}, { 3.516468468723984*^9, 3.5164684717191896`*^9}, 3.518975728299235*^9, { 3.5217353887887383`*^9, 3.521735394763549*^9}, {3.521935776933593*^9, 3.521935800955967*^9}, {3.5219358478386483`*^9, 3.5219358749371986`*^9}, { 3.5219359981069856`*^9, 3.521935998216186*^9}, {3.521936494840366*^9, 3.5219364977035294`*^9}, {3.5219367564051676`*^9, 3.5219367585423717`*^9}, {3.521936796107238*^9, 3.521936798213241*^9}, { 3.521981850219365*^9, 3.521981852340969*^9}, {3.521988842900447*^9, 3.5219888439612494`*^9}, {3.5225079531682897`*^9, 3.5225079543382916`*^9}, {3.523729761408847*^9, 3.523729764014052*^9}, { 3.5237300959622355`*^9, 3.5237300973506374`*^9}, {3.523730250418106*^9, 3.5237302525553102`*^9}, {3.528219323311225*^9, 3.5282193250584283`*^9}, { 3.5356685603769655`*^9, 3.535668570727557*^9}, {3.5356686343931985`*^9, 3.5356686688351684`*^9}, {3.535670581595766*^9, 3.535670583093369*^9}, { 3.5523191673833647`*^9, 3.5523192002526226`*^9}, {3.552654131567648*^9, 3.5526541325036497`*^9}, {3.558893106738725*^9, 3.558893108766729*^9}, { 3.5588932753438215`*^9, 3.558893278042626*^9}, {3.558893363296776*^9, 3.5588933661359806`*^9}, {3.5644139508219585`*^9, 3.564413952459962*^9}, { 3.5697655161323247`*^9, 3.569765534337557*^9}, {3.569765721615883*^9, 3.5697657228950853`*^9}, {3.569766444224743*^9, 3.5697665246428833`*^9}, { 3.5763476580905147`*^9, 3.576347660336919*^9}, {3.5896551465648627`*^9, 3.589655151832164*^9}, {3.5896551821138964`*^9, 3.5896551827699337`*^9}, { 3.5896553654583826`*^9, 3.5896554291760273`*^9}, {3.5896554928096666`*^9, 3.5896555784925675`*^9}, {3.58965561332656*^9, 3.5896556426752386`*^9}, { 3.5898265194327183`*^9, 3.5898265692195663`*^9}, {3.589827265453388*^9, 3.589827267317495*^9}, {3.5915324671510825`*^9, 3.5915324675878835`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{ "This", " ", "step", " ", "is", " ", "optional", " ", "and", " ", "allows", " ", "user", " ", "to", " ", "override", " ", "the", " ", "computer"}], "-", RowBox[{ "chosen", " ", "offset", " ", "coordinates", " ", "for", " ", "each", " ", "movie", " ", "with", " ", "a", " ", "single", " ", RowBox[{"value", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"OffsetCoordinates", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "totals", "]"}], ",", "1"}], "}"}]}], "]"}]}], ";"}]}]], "Input", CellChangeTimes->{{3.5219366345689535`*^9, 3.5219366479537773`*^9}, 3.5219368021912484`*^9, 3.521942377663334*^9, {3.521982018372061*^9, 3.521982030103281*^9}, {3.5225046265060296`*^9, 3.5225046285964336`*^9}, { 3.522585060048072*^9, 3.522585069517288*^9}, 3.5225978311691723`*^9, { 3.523730203930025*^9, 3.523730209764435*^9}, {3.5282194162717886`*^9, 3.528219423338601*^9}, 3.5356706034514046`*^9, {3.552319231047076*^9, 3.5523192334806805`*^9}, {3.5588939472838016`*^9, 3.558893949545806*^9}, { 3.561985643794162*^9, 3.5619856465493193`*^9}, {3.563896351754244*^9, 3.563896380441885*^9}, {3.564410771645128*^9, 3.5644107717151318`*^9}, { 3.5644110057575183`*^9, 3.564411008358667*^9}, {3.5644117791619787`*^9, 3.564411781595583*^9}, {3.5644139063150806`*^9, 3.564413938997138*^9}, { 3.5697668860667143`*^9, 3.5697668930555267`*^9}, {3.5817863751851416`*^9, 3.581786376932345*^9}, {3.583257033966975*^9, 3.583257036306979*^9}, 3.5896549675586243`*^9, {3.5896549981933765`*^9, 3.58965510664458*^9}, { 3.5898266023594613`*^9, 3.5898266210675316`*^9}, {3.5898273486441464`*^9, 3.5898273504922523`*^9}, {3.5915324783051023`*^9, 3.591532484077112*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Set Image Processing Parameters for Left Channel\ \>", "Subsection", CellChangeTimes->{{3.4675638562210436`*^9, 3.4675638642890434`*^9}, { 3.49824511708331*^9, 3.498245125864184*^9}, 3.5003908737562227`*^9, { 3.589656222677413*^9, 3.589656229372796*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Definitions", " ", "for", " ", "subsequent", " ", "image", " ", "processing"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{"image_", ",", "movie_", ",", "side_", ",", "paramlist_"}], "]"}], ":=", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"side", ",", RowBox[{"{", "\"\<\>\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "\[Equal]", "\"\\""}], ")"}], "||", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"side", ",", RowBox[{"{", "\"\<\>\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "==", "\"\\""}], ")"}]}], ",", RowBox[{"ImageTake", "[", RowBox[{ RowBox[{"ImageTake", "[", RowBox[{"image", ",", "All", ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "1", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], ",", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "2", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "3", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "4", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "-", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "3", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "+", "1"}], ")"}], ">", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "5", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "3", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "+", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "5", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "-", "1"}], ",", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "4", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "6", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "7", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "-", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "6", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "+", "1"}], ")"}], ">", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "8", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}]}], ",", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "6", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "+", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "8", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "-", "1"}], ",", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "7", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}]}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"side", ",", RowBox[{"{", "\"\<\>\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "\[Equal]", "\"\\""}], ")"}], "||", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"side", ",", RowBox[{"{", "\"\<\>\"", "}"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "==", "\"\\""}], ")"}]}], ",", RowBox[{"ImageTake", "[", RowBox[{ RowBox[{"ImageTake", "[", RowBox[{"image", ",", "All", ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "9", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], ",", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "10", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "11", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "11", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "+", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "5", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "12", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "12", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "+", RowBox[{ RowBox[{"paramlist", "[", RowBox[{"[", "8", "]"}], "]"}], "[", RowBox[{"[", "movie", "]"}], "]"}], "-", "1"}]}], "}"}]}], "]"}], ",", "\"\\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Xstart", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "<", "0"}], ",", "1", ",", RowBox[{"1", "+", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], "]"}], "&"}], ",", "OffsetCoordinates"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Ystart", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "<", "0"}], ",", "1", ",", RowBox[{"1", "+", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "]"}], "&"}], ",", "OffsetCoordinates"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Xend", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"OffsetCoordinates", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "<", "0"}], ",", RowBox[{ RowBox[{"LHSend", "[", RowBox[{"[", "i", "]"}], "]"}], "+", RowBox[{"OffsetCoordinates", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}]}], ",", RowBox[{"LHSend", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "OffsetCoordinates", "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Yend", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"OffsetCoordinates", "[", RowBox[{"[", RowBox[{"i", ",", "2"}], "]"}], "]"}], "<", "0"}], ",", RowBox[{ RowBox[{"PixelLength", "[", RowBox[{"[", "i", "]"}], "]"}], "+", RowBox[{"OffsetCoordinates", "[", RowBox[{"[", RowBox[{"i", ",", "2"}], "]"}], "]"}]}], ",", RowBox[{"PixelLength", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "OffsetCoordinates", "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RHSxStart", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "<", "0"}], ",", RowBox[{"1", "-", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}]}], ",", "1"}], "]"}], "&"}], ",", "OffsetCoordinates"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RHSyStart", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "<", "0"}], ",", RowBox[{"1", "-", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", "1"}], "]"}], "&"}], ",", "OffsetCoordinates"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"width", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{ RowBox[{"Xend", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"(", RowBox[{ RowBox[{"Xstart", "[", RowBox[{"[", "i", "]"}], "]"}], "-", "1"}], ")"}]}], ",", RowBox[{ RowBox[{"RHSwidth", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"(", RowBox[{ RowBox[{"RHSxStart", "[", RowBox[{"[", "i", "]"}], "]"}], "-", "1"}], ")"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "Xend", "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"height", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Min", "[", RowBox[{ RowBox[{ RowBox[{"Yend", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"(", RowBox[{ RowBox[{"Ystart", "[", RowBox[{"[", "i", "]"}], "]"}], "-", "1"}], ")"}]}], ",", RowBox[{ RowBox[{"PixelLength", "[", RowBox[{"[", "i", "]"}], "]"}], "-", RowBox[{"(", RowBox[{ RowBox[{"RHSyStart", "[", RowBox[{"[", "i", "]"}], "]"}], "-", "1"}], ")"}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "Yend", "]"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskRadiusListLHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"1.5", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskMagnitudeListLHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"1", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"BlurListLHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"5", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RegionSelectionPointsLHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"512", ",", "1"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ThresholdListLHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"0.026", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MovieIndexLHS", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"FramesIndexLHS", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "MovieIndexLHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "FramesIndexLHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "DiskRadiusListLHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "DiskMagnitudeListLHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "ThresholdListLHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "BlurListLHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskRadiusListRHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"1.5", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskMagnitudeListRHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"1", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"BlurListRHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"5", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RegionSelectionPointsRHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"512", ",", "1"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ThresholdListRHS", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{"0.02", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "j", "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "NumberOfMovies"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MovieIndexRHS", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"FramesIndexRHS", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "MovieIndexRHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "FramesIndexRHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "DiskRadiusListRHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "DiskMagnitudeListRHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "ThresholdListRHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Dynamic", "[", "BlurListRHS", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"AlignmentParameters", "=", RowBox[{"{", RowBox[{ "LHSbegin", ",", "LHSend", ",", "Ystart", ",", "Yend", ",", "height", ",", "Xstart", ",", "Xend", ",", "width", ",", "RHSstart", ",", "RHSend", ",", "RHSyStart", ",", "RHSxStart"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"BinarizationImageLHS", "=", RowBox[{"Dynamic", "[", RowBox[{"ImageApply", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"#", "\[Equal]", "1"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "#", ",", "0"}], "}"}]}], "]"}], "&"}], ",", RowBox[{"ImageAdd", "[", RowBox[{ RowBox[{"ImageAdjust", "[", RowBox[{"ImageMultiply", "[", RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], ",", "\"\\""}], "]"}], ",", "MovieIndexLHS", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{"Rasterize", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Polygon", "[", RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", " ", "FramesIndexLHS"}], "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Background", "\[Rule]", "Black"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}]}], "}"}]}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}]}]}], "]"}], ",", "\"\\""}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{ RowBox[{"ImageMultiply", "[", RowBox[{ RowBox[{"ImageConvolve", "[", RowBox[{ RowBox[{"ImageSubtract", "[", RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], ",", "\"\\""}], "]"}], ",", "MovieIndexLHS", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], ",", RowBox[{"Blur", "[", RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], ",", "\"\\""}], "]"}], ",", "MovieIndexLHS", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], ",", RowBox[{"BlurListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}]}], "]"}]}], "]"}], ",", RowBox[{ RowBox[{"DiskMatrix", "[", RowBox[{"DiskRadiusListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}], "*", RowBox[{"DiskMagnitudeListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}]}]}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{"Rasterize", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Polygon", "[", RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", " ", "FramesIndexLHS"}], "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Background", "\[Rule]", "Black"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}]}], "}"}]}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}]}]}], "]"}], ",", "\"\\""}], "]"}], "]"}]}], "]"}], ",", RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}]}], "]"}]}], "]"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"BinarizationImageRHS", "=", RowBox[{"Dynamic", "[", RowBox[{"ImageApply", "[", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"#", "\[Equal]", "1"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "#", ",", "0"}], "}"}]}], "]"}], "&"}], ",", RowBox[{"ImageAdd", "[", RowBox[{ RowBox[{"ImageAdjust", "[", RowBox[{"ImageMultiply", "[", RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], ",", "\"\\""}], "]"}], ",", "MovieIndexRHS", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{"Rasterize", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Polygon", "[", RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", " ", "FramesIndexRHS"}], "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Background", "\[Rule]", "Black"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}]}], "}"}]}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}]}]}], "]"}], ",", "\"\\""}], "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{ RowBox[{"ImageMultiply", "[", RowBox[{ RowBox[{"ImageConvolve", "[", RowBox[{ RowBox[{"ImageSubtract", "[", RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], ",", "\"\\""}], "]"}], ",", "MovieIndexRHS", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], ",", RowBox[{"Blur", "[", RowBox[{ RowBox[{"ImageAlignment", "[", RowBox[{ RowBox[{"Import", "[", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], ",", "\"\\""}], "]"}], ",", "MovieIndexRHS", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], ",", RowBox[{"BlurListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}]}], "]"}]}], "]"}], ",", RowBox[{ RowBox[{"DiskMatrix", "[", RowBox[{"DiskRadiusListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}], "*", RowBox[{"DiskMagnitudeListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}]}]}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{"Rasterize", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Polygon", "[", RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", " ", "FramesIndexRHS"}], "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Background", "\[Rule]", "Black"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}]}], "}"}]}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}]}]}], "]"}], ",", "\"\\""}], "]"}], "]"}]}], "]"}], ",", RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}]}], "]"}]}], "]"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SetRemainingFramesLHS", "[", RowBox[{"Movie_", ",", "CurrentFrame_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{ RowBox[{ RowBox[{"DiskRadiusListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"DiskRadiusListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskMagnitudeListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"DiskMagnitudeListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", RowBox[{ RowBox[{"BlurListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"BlurListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SetRemainingFramesRHS", "[", RowBox[{"Movie_", ",", "CurrentFrame_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{ RowBox[{ RowBox[{"DiskRadiusListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"DiskRadiusListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskMagnitudeListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"DiskMagnitudeListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", RowBox[{ RowBox[{"BlurListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"BlurListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", RowBox[{"CurrentFrame", ";;", RowBox[{"MovieLengths", "[", RowBox[{"[", "Movie", "]"}], "]"}]}]}], "]"}], "]"}], "=", RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SetAllMoviesLHS", "[", RowBox[{"Movie_", ",", "CurrentFrame_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{ RowBox[{ RowBox[{"DiskRadiusListLHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"DiskRadiusListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskMagnitudeListLHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"DiskMagnitudeListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", RowBox[{ RowBox[{"BlurListLHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"BlurListLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SetAllMoviesRHS", "[", RowBox[{"Movie_", ",", "CurrentFrame_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "}"}], ",", RowBox[{ RowBox[{ RowBox[{"DiskRadiusListRHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"DiskRadiusListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"DiskMagnitudeListRHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"DiskMagnitudeListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", RowBox[{ RowBox[{"BlurListRHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"BlurListRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"All", ",", "All"}], "]"}], "]"}], "=", RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"Movie", ",", "CurrentFrame"}], "]"}], "]"}]}], ";"}]}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.465842017881279*^9, 3.4658421566744795`*^9}, { 3.4658429902136793`*^9, 3.4658430245024796`*^9}, {3.4658543022818794`*^9, 3.465854374946679*^9}, {3.465854409875079*^9, 3.465854485753479*^9}, { 3.4658545498226795`*^9, 3.4658546257322793`*^9}, {3.465854751920679*^9, 3.465854778830679*^9}, {3.4658573124110794`*^9, 3.465857318198679*^9}, { 3.465859456757479*^9, 3.4658594586294794`*^9}, {3.4661783776024*^9, 3.4661783854804*^9}, 3.4675638910920434`*^9, {3.477788436696694*^9, 3.4777884639342937`*^9}, {3.477788660697094*^9, 3.4777886608062935`*^9}, { 3.4934929042086*^9, 3.4934929357956*^9}, {3.500747663411798*^9, 3.5007476889022427`*^9}, {3.500747729134713*^9, 3.5007477554831595`*^9}, { 3.508611314479488*^9, 3.508611314916289*^9}, {3.5086816141758375`*^9, 3.5086816380438795`*^9}, {3.508681687433566*^9, 3.5086817016295915`*^9}, { 3.5526537035136056`*^9, 3.5526537036228056`*^9}, {3.5644141099266386`*^9, 3.564414113031044*^9}, {3.5698726166190276`*^9, 3.569872619473832*^9}, 3.576348207714673*^9, {3.581786600933135*^9, 3.581786604146741*^9}, { 3.583256041719243*^9, 3.583256048754855*^9}, {3.583256347292576*^9, 3.5832563714102182`*^9}, {3.5832572433817406`*^9, 3.5832572468137465`*^9}, {3.589655667045633*^9, 3.5896556972413597`*^9}, { 3.5896559064273243`*^9, 3.58965592067614*^9}, {3.5896559826966867`*^9, 3.5896559828606963`*^9}, {3.5915322146022425`*^9, 3.5915322246486597`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Allows", " ", "visualization", " ", "and", " ", "user", " ", "determination", " ", "of", " ", "object", " ", "identification", " ", "parameters", " ", "for", " ", "the", " ", "left", " ", RowBox[{"channel", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"Panel", "[", RowBox[{"Column", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Panel", "[", RowBox[{"Column", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{ "\"\\"", ",", "18"}], "]"}], ",", RowBox[{"Grid", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", "MovieIndexLHS", "]"}], ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Length", "[", "MovieLengths", "]"}], ",", "1"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Animator", "[", RowBox[{ RowBox[{"Dynamic", "[", "FramesIndexLHS", "]"}], ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "MovieIndexLHS", "]"}], "]"}], ",", "1"}], "}"}], ",", RowBox[{"Dynamic", "[", "FramesIndexLHS", "]"}], ",", RowBox[{"AnimationRunning", "\[Rule]", "False"}]}], "]"}], ",", RowBox[{"Dynamic", "[", "FramesIndexLHS", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"DiskRadiusListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"1", ",", "5", ",", ".25"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"DiskMagnitudeListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"0.1", ",", "2", ",", ".001"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Animator", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", ".001"}], "}"}], ",", RowBox[{"Dynamic", "[", RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"AnimationRunning", "\[Rule]", "False"}], ",", RowBox[{"AppearanceElements", "\[Rule]", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}], ",", RowBox[{"Dynamic", "[", RowBox[{"ThresholdListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"BlurListLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"5", ",", "30", ",", "1"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Button", "[", RowBox[{"\"\\"", ",", RowBox[{"SetAllMoviesLHS", "[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}]}], "]"}], ",", RowBox[{"Button", "[", RowBox[{ "\"\\"", ",", RowBox[{"SetRemainingFramesLHS", "[", RowBox[{"MovieIndexLHS", ",", "FramesIndexLHS"}], "]"}]}], "]"}]}], "}"}]}], "}"}], ",", RowBox[{"Alignment", "\[Rule]", "Left"}]}], "]"}]}], "}"}], ",", RowBox[{"Alignment", "\[Rule]", "Center"}]}], "]"}], "]"}], ",", RowBox[{"Panel", "[", RowBox[{"LocatorPane", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"RegionSelectionPointsLHS", "[", RowBox[{"[", RowBox[{"MovieIndexLHS", ",", " ", "FramesIndexLHS"}], "]"}], "]"}], "]"}], ",", "BinarizationImageLHS"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Alignment", "\[Rule]", "Center"}], ",", RowBox[{"ItemSize", "\[Rule]", "Full"}]}], "]"}], "]"}]}]], "Input", CellChangeTimes->{ 3.465842051717679*^9, {3.465842228668479*^9, 3.4658422572164793`*^9}, { 3.465842291598879*^9, 3.465842296247679*^9}, {3.465842338008879*^9, 3.465842416149279*^9}, {3.465842792031279*^9, 3.4658429859548793`*^9}, { 3.465843070163679*^9, 3.4658430772460794`*^9}, {3.465843259469679*^9, 3.465843280888479*^9}, 3.465843361887679*^9, {3.465843417395479*^9, 3.465843435397879*^9}, {3.4658435252090793`*^9, 3.465843525489879*^9}, { 3.465843561463479*^9, 3.465843591306279*^9}, 3.465843665515479*^9, { 3.4658437134230795`*^9, 3.465843735185079*^9}, {3.465843951978279*^9, 3.4658439663458796`*^9}, {3.465847611707079*^9, 3.4658476327046795`*^9}, { 3.465847701407079*^9, 3.4658477048702793`*^9}, 3.4658477568182793`*^9, { 3.465847867001079*^9, 3.4658480657606792`*^9}, {3.465848100938679*^9, 3.4658481062894793`*^9}, {3.465854677321479*^9, 3.4658546851526794`*^9}, { 3.465854929932279*^9, 3.465854944721079*^9}, {3.465856146155079*^9, 3.465856292748279*^9}, {3.465856487249079*^9, 3.4658565525038795`*^9}, { 3.465856655978679*^9, 3.4658566605338793`*^9}, {3.4658569037066793`*^9, 3.4658569141898794`*^9}, {3.465857234208279*^9, 3.465857242070679*^9}, { 3.4658572899938793`*^9, 3.4658572939406796`*^9}, {3.4658594802354794`*^9, 3.4658594905626793`*^9}, {3.4777886860002937`*^9, 3.4777887236118937`*^9}, 3.4934894818375998`*^9, {3.4934899814586*^9, 3.4934899961306*^9}, 3.4934901410826*^9, {3.4934905405786*^9, 3.4934905488796*^9}, { 3.4934905867335997`*^9, 3.4934905890566*^9}, 3.4934929928676*^9, { 3.493644306582614*^9, 3.493644309281414*^9}, {3.4940720077030783`*^9, 3.494072008077479*^9}, {3.494072067622783*^9, 3.4940720728019924`*^9}, 3.5001352658969436`*^9, 3.500135328094253*^9, {3.500135382304348*^9, 3.5001354355472417`*^9}, {3.5001354810057216`*^9, 3.5001354925497417`*^9}, {3.5007507891406884`*^9, 3.500750871493233*^9}, { 3.501452811751279*^9, 3.501452811876079*^9}, {3.5085246942458715`*^9, 3.5085246946826725`*^9}, {3.5085247613415895`*^9, 3.50852476177839*^9}, { 3.5086816676059313`*^9, 3.5086816680271325`*^9}, 3.5086817180564203`*^9, { 3.589655939425212*^9, 3.5896559697279453`*^9}, {3.5896560023378105`*^9, 3.5896560253241253`*^9}}], Cell[BoxData[ PanelBox[ TagBox[GridBox[{ { PanelBox[ TagBox[GridBox[{ { StyleBox["\<\"Determine Parameters for Object Identification\"\>", StripOnInput->False, FontSize->18]}, { TagBox[GridBox[{ {"\<\"Movie Index\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[$CellContext`MovieIndexLHS], {1, 1, 1}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[$CellContext`MovieIndexLHS], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[$CellContext`MovieIndexLHS], {1, 1, 1}]], ""}, {"\<\"Frame Index\"\>", AnimatorBox[Dynamic[$CellContext`FramesIndexLHS], {1, 100, 1}, AnimationRate->Dynamic[$CellContext`FramesIndexLHS], PausedTime->0], DynamicBox[ToBoxes[$CellContext`FramesIndexLHS, StandardForm], ImageSizeCache->{8., {0., 11.}}]}, {"\<\"Disk Radius\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[ Part[$CellContext`DiskRadiusListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], {1, 5, 0.25}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[ Part[$CellContext`DiskRadiusListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[ Part[$CellContext`DiskRadiusListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], {1, 5, 0.25}]], ""}, {"\<\"Disk Magnitude\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[ Part[$CellContext`DiskMagnitudeListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], {0.1, 2, 0.001}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[ Part[$CellContext`DiskMagnitudeListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[ Part[$CellContext`DiskMagnitudeListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], {0.1, 2, 0.001}]], ""}, {"\<\"Threshold\"\>", AnimatorBox[Dynamic[ Part[$CellContext`ThresholdListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], {0, 1, 0.001}, AnimationRate->Dynamic[ Part[$CellContext`ThresholdListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], AppearanceElements->{ "ProgressSlider", "StepLeftButton", "StepRightButton"}, PausedTime->0], DynamicBox[ToBoxes[ Part[$CellContext`ThresholdListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS], StandardForm], ImageSizeCache->{35., {0., 11.}}]}, {"\<\"Blur Radius\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[ Part[$CellContext`BlurListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], {5, 30, 1}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[ Part[$CellContext`BlurListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[ Part[$CellContext`BlurListLHS, $CellContext`MovieIndexLHS, \ $CellContext`FramesIndexLHS]], {5, 30, 1}]], ""}, { ButtonBox["\<\"Set All Movies to these Parameters\"\>", Appearance->Automatic, ButtonFunction:>$CellContext`SetAllMoviesLHS[$CellContext`\ MovieIndexLHS, $CellContext`FramesIndexLHS], Evaluator->Automatic, Method->"Preemptive"], ButtonBox["\<\"Set Remaining Frames in this Movie to these \ Parameters\"\>", Appearance->Automatic, ButtonFunction:>$CellContext`SetRemainingFramesLHS[$\ CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS], Evaluator->Automatic, Method->"Preemptive"], ""} }, AutoDelete->False, GridBoxAlignment->{"Columns" -> {{Left}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], "Grid"]} }, DefaultBaseStyle->"Column", GridBoxAlignment->{"Columns" -> {{Center}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], "Column"]]}, { PanelBox[ LocatorPaneBox[Dynamic[ Part[$CellContext`RegionSelectionPointsLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], DynamicBox[ToBoxes[ ImageApply[If[# == 1, {1, 0, 0}, {0, #, 0}]& , ImageAdd[ ImageAdjust[ ImageMultiply[ $CellContext`ImageAlignment[ Import[ Part[$CellContext`MovieFiles, $CellContext`MovieIndexLHS, \ $CellContext`FramesIndexLHS], "TIFF"], $CellContext`MovieIndexLHS, "left", $CellContext`AlignmentParameters], Binarize[ Rasterize[ Graphics[{White, Polygon[ Part[$CellContext`RegionSelectionPointsLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]]}, Background -> Black, PlotRange -> {{0, 512}, {0, 512}}, ImageSize -> {512, 512}], "Image"]]]], Binarize[ ImageMultiply[ ImageConvolve[ ImageSubtract[ $CellContext`ImageAlignment[ Import[ Part[$CellContext`MovieFiles, $CellContext`MovieIndexLHS, \ $CellContext`FramesIndexLHS], "TIFF"], $CellContext`MovieIndexLHS, "left", $CellContext`AlignmentParameters], Blur[ $CellContext`ImageAlignment[ Import[ Part[$CellContext`MovieFiles, $CellContext`MovieIndexLHS, \ $CellContext`FramesIndexLHS], "TIFF"], $CellContext`MovieIndexLHS, "left", $CellContext`AlignmentParameters], Part[$CellContext`BlurListLHS, $CellContext`MovieIndexLHS, \ $CellContext`FramesIndexLHS]]], DiskMatrix[ Part[$CellContext`DiskRadiusListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]] Part[$CellContext`DiskMagnitudeListLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]], Binarize[ Rasterize[ Graphics[{White, Polygon[ Part[$CellContext`RegionSelectionPointsLHS, \ $CellContext`MovieIndexLHS, $CellContext`FramesIndexLHS]]}, Background -> Black, PlotRange -> {{0, 512}, {0, 512}}, ImageSize -> {512, 512}], "Image"]]], Part[$CellContext`ThresholdListLHS, $CellContext`MovieIndexLHS, \ $CellContext`FramesIndexLHS]]]], StandardForm], ImageSizeCache->{310., {316., 323.}}]]]} }, DefaultBaseStyle->"Column", GridBoxAlignment->{"Columns" -> {{Center}}}, GridBoxItemSize->{"Columns" -> {{All}}, "Rows" -> {{All}}}], "Column"]]], "Output", CellChangeTimes->{ 3.465843030414879*^9, 3.4658430785408792`*^9, {3.465843277752879*^9, 3.465843281309679*^9}, 3.4658433624960794`*^9, {3.465843420952279*^9, 3.465843436021879*^9}, 3.4658435258486795`*^9, {3.4658435665178795`*^9, 3.465843591945879*^9}, 3.4658436668414793`*^9, {3.4658437144994793`*^9, 3.4658437358870792`*^9}, 3.4658437695986795`*^9, 3.465843967547079*^9, { 3.465847616371479*^9, 3.465847635216279*^9}, 3.4658477054162793`*^9, 3.465847757738679*^9, 3.4658480172446795`*^9, 3.465848066681079*^9, 3.465848113917879*^9, 3.465854966264679*^9, {3.465856277865879*^9, 3.465856294308279*^9}, {3.465856495142679*^9, 3.4658566000682793`*^9}, { 3.4658566638254795`*^9, 3.4658566668986793`*^9}, {3.465856875455079*^9, 3.4658568795422792`*^9}, {3.4658569237214794`*^9, 3.4658570088506794`*^9}, {3.4658572437242794`*^9, 3.465857294783079*^9}, { 3.4658578955078793`*^9, 3.4658579224334793`*^9}, {3.465858223341879*^9, 3.465858244682679*^9}, {3.4658584359096794`*^9, 3.465858476547679*^9}, { 3.4658593497712793`*^9, 3.4658593549348793`*^9}, {3.4658595361926794`*^9, 3.465859561620679*^9}, 3.4658598754780793`*^9, {3.4658605808632793`*^9, 3.465860602235279*^9}, {3.4659080090452795`*^9, 3.465908054020079*^9}, { 3.465935762342679*^9, 3.4659357736058793`*^9}, {3.4661732297584*^9, 3.4661732352184*^9}, {3.4661736235336*^9, 3.4661736393676*^9}, { 3.4661736721744003`*^9, 3.4661736786796*^9}, {3.4661871172523003`*^9, 3.4661871226811*^9}, {3.4661922687623*^9, 3.4661922918347*^9}, 3.466447241259237*^9, {3.4664479477812366`*^9, 3.466447982601237*^9}, { 3.4664514661917367`*^9, 3.4664514704505367`*^9}, 3.4669686762631025`*^9, { 3.4669687375399027`*^9, 3.466968754325503*^9}, {3.4670368943143024`*^9, 3.4670368950475025`*^9}, {3.467036931754303*^9, 3.467036960988703*^9}, 3.4671279113700027`*^9, {3.467144338379903*^9, 3.4671443873951025`*^9}, { 3.467144447408303*^9, 3.4671444523535028`*^9}, 3.467144973159503*^9, { 3.467145073888703*^9, 3.467145078974303*^9}, 3.4671452194689026`*^9, 3.467305986826903*^9, 3.4673071589485025`*^9, 3.467320737391303*^9, { 3.467320781726503*^9, 3.467320911066103*^9}, {3.4673226696551027`*^9, 3.4673226803879027`*^9}, 3.4674016240192003`*^9, {3.4674027944248*^9, 3.467403071356*^9}, {3.4674031067992*^9, 3.4674032626744003`*^9}, { 3.4674032979927998`*^9, 3.467403311674*^9}, 3.4674679144891434`*^9, 3.4675612863484435`*^9, 3.4675618732672434`*^9, 3.468604520030559*^9, { 3.468604554225759*^9, 3.4686047017705593`*^9}, {3.468604772454159*^9, 3.468604954989759*^9}, 3.4686078883410587`*^9, {3.468607931724659*^9, 3.468607935499859*^9}, {3.468608094120659*^9, 3.468608123292659*^9}, { 3.468608154258659*^9, 3.468608203055459*^9}, {3.468608330039459*^9, 3.468608476866659*^9}, {3.4686085101258593`*^9, 3.468608624037059*^9}, 3.4691928630001593`*^9, {3.469192898568159*^9, 3.469193028937359*^9}, { 3.469193091852159*^9, 3.4691933880025587`*^9}, {3.469193786738559*^9, 3.469193791371759*^9}, {3.469193834599359*^9, 3.469193843085759*^9}, 3.4736069517433*^9, {3.4736069834269*^9, 3.4736070118501*^9}, { 3.4736142123437*^9, 3.4736142269297*^9}, {3.4736143105769*^9, 3.4736143148824997`*^9}, 3.4752421990411863`*^9, {3.475266204559087*^9, 3.4752662473820868`*^9}, {3.4771575169414*^9, 3.4771575310282*^9}, { 3.4771575723526*^9, 3.4771577582578*^9}, {3.477159622047*^9, 3.4771596230766*^9}, {3.4771619394112*^9, 3.4771620023822002`*^9}, { 3.4771620791029997`*^9, 3.4771622743838*^9}, {3.477759209332694*^9, 3.477759261873494*^9}, {3.4777592985802937`*^9, 3.477759665539094*^9}, { 3.4777607268392935`*^9, 3.4777609832564936`*^9}, {3.4777610178104935`*^9, 3.477761127962094*^9}, {3.4777611666812935`*^9, 3.477761245742094*^9}, { 3.477763612866294*^9, 3.477763614020694*^9}, {3.4777637360302935`*^9, 3.477763889799494*^9}, {3.4777657435816936`*^9, 3.477765752723294*^9}, { 3.477765851341894*^9, 3.4777659546918936`*^9}, 3.477774732970294*^9, { 3.477774794184694*^9, 3.477774871498294*^9}, {3.477774911231494*^9, 3.4777750712718935`*^9}, {3.477775118555494*^9, 3.4777751190546937`*^9}, { 3.477775216695094*^9, 3.477775287363094*^9}, 3.477788771659894*^9, 3.4777888336854935`*^9, {3.477788913604294*^9, 3.4777889321370935`*^9}, 3.4777889973450937`*^9, {3.4777890505878935`*^9, 3.4777890852354937`*^9}, { 3.477789118291894*^9, 3.4777891285878935`*^9}, {3.477789160739494*^9, 3.477789180161494*^9}, 3.477789365271094*^9, {3.4777893985458937`*^9, 3.477789417437494*^9}, {3.477789475407094*^9, 3.4777895493666935`*^9}, { 3.4777896511722937`*^9, 3.4777897496082935`*^9}, 3.477789814114294*^9, { 3.477789851585494*^9, 3.477789896045494*^9}, {3.477789973171894*^9, 3.4777900106898937`*^9}, {3.477790086895894*^9, 3.477790123618294*^9}, { 3.477790190308294*^9, 3.4777902123822937`*^9}, {3.4778228538382*^9, 3.4778233330858*^9}, {3.4778233916638002`*^9, 3.4778234073262*^9}, { 3.4778576861738*^9, 3.4778577101354*^9}, {3.4778577713342*^9, 3.4778578172762003`*^9}, {3.477857871611*^9, 3.4778580781549997`*^9}, { 3.477858109277*^9, 3.477858179321*^9}, 3.4934851722536*^9, { 3.4934852875165997`*^9, 3.4934853113736*^9}, 3.4934853464886*^9, 3.4934854259276*^9, 3.4934854773206*^9, {3.4934855228626003`*^9, 3.4934855616436*^9}, 3.4934856112446003`*^9, {3.4934857699245996`*^9, 3.4934857829736*^9}, 3.4934858712346*^9, 3.4934859795425997`*^9, 3.4934860225576*^9, 3.4934863513946*^9, 3.4934864011156*^9, 3.4934865689186*^9, {3.4934866518226*^9, 3.4934866666726*^9}, { 3.4934867245566*^9, 3.4934867392776003`*^9}, 3.4934867871605997`*^9, 3.4934868437656*^9, 3.4934871826906*^9, {3.4934872843585997`*^9, 3.4934873008816*^9}, {3.4934877715856*^9, 3.4934878135886*^9}, 3.4934901427686*^9, 3.4934902831006002`*^9, 3.4934905500036*^9, 3.4934905906956*^9, 3.4934906362616*^9, 3.4934911723666*^9, 3.4934912359296*^9, 3.4934912713506002`*^9, {3.4934913640506*^9, 3.4934913773326*^9}, 3.4934924285416*^9, {3.4934925902686*^9, 3.4934926157386*^9}, {3.4934930322566*^9, 3.4934930567766*^9}, { 3.4934931289236*^9, 3.4934931581236*^9}, {3.4934932819666*^9, 3.4934933257446003`*^9}, 3.4936439492022142`*^9, {3.493643984707814*^9, 3.493643995393814*^9}, {3.493644099586214*^9, 3.4936442073198137`*^9}, 3.493644239939414*^9, {3.493644311683814*^9, 3.493644315381014*^9}, 3.4936443614010143`*^9, {3.493661146388814*^9, 3.493661176278414*^9}, { 3.493661234591214*^9, 3.493661258521614*^9}, {3.493664114120214*^9, 3.4936641182472143`*^9}, {3.494071558779686*^9, 3.49407164085143*^9}, 3.494071840236784*^9, 3.4940720231159053`*^9, 3.494072073129593*^9, { 3.4940721280104895`*^9, 3.4940721840301876`*^9}, {3.494072241173088*^9, 3.494072248926302*^9}, {3.494072329516043*^9, 3.4940723758013244`*^9}, { 3.494072463457878*^9, 3.4940725385408106`*^9}, {3.494072608116933*^9, 3.494072609364935*^9}, {3.494072676725853*^9, 3.4940728770614047`*^9}, { 3.4940729220986843`*^9, 3.4940729814723883`*^9}, 3.4940765743529544`*^9, { 3.4940767161416035`*^9, 3.4940767340816355`*^9}, 3.494334556927701*^9, { 3.494334652072268*^9, 3.4943346910879364`*^9}, 3.4945992600983043`*^9, { 3.494599455019453*^9, 3.4945994651230307`*^9}, {3.4945996748270254`*^9, 3.4945997015205517`*^9}, {3.49459975393155*^9, 3.494599774793743*^9}, { 3.494678987622849*^9, 3.4946790214437084`*^9}, {3.4946790771826067`*^9, 3.4946790785242085`*^9}, 3.496497388288991*^9, {3.496497457616956*^9, 3.4964974659144306`*^9}, 3.4964990643388557`*^9, 3.4965000090928926`*^9, { 3.4965138916349287`*^9, 3.496513919131501*^9}, 3.496532739459908*^9, 3.5001351455959325`*^9, 3.5001352675349464`*^9, {3.5001353227278433`*^9, 3.5001353346150646`*^9}, 3.5001354376220455`*^9, {3.5001354846093283`*^9, 3.500135493376543*^9}, {3.5001357030397124`*^9, 3.500135756204606*^9}, { 3.5001364777698746`*^9, 3.5001365237119555`*^9}, {3.5001367499787536`*^9, 3.5001367905856247`*^9}, {3.5001368498813286`*^9, 3.5001368875709953`*^9}, {3.500137058750096*^9, 3.5001370837257395`*^9}, { 3.5001378924351606`*^9, 3.5001379933049374`*^9}, {3.5007509529721766`*^9, 3.5007509650309973`*^9}, {3.5014295285495033`*^9, 3.5014295384399204`*^9}, 3.5014409929510403`*^9, {3.501441373217308*^9, 3.501441392311742*^9}, { 3.501448906833705*^9, 3.5014489149731703`*^9}, {3.5014498383789*^9, 3.501449848284917*^9}, 3.5014505699155293`*^9, 3.5014510589166*^9, 3.5014527511139727`*^9, 3.5014528135452824`*^9, {3.501454611776041*^9, 3.5014546206992564`*^9}, 3.501457825693442*^9, {3.5014635501093836`*^9, 3.501463555522593*^9}, 3.5014697870214148`*^9, {3.501470019383823*^9, 3.501470026981036*^9}, 3.50147293112275*^9, 3.501525470879952*^9, { 3.501525799525729*^9, 3.501525825499775*^9}, {3.5060886502418537`*^9, 3.5060886556394634`*^9}, 3.506094792159704*^9, {3.5060993112629085`*^9, 3.5060993158961163`*^9}, {3.5060993482037735`*^9, 3.506099356300187*^9}, 3.5060993864550405`*^9, {3.5061043532077646`*^9, 3.5061043578565726`*^9}, 3.507173154557218*^9, {3.50851637579286*^9, 3.508516380254468*^9}, 3.5085165951136456`*^9, 3.5085172436847844`*^9, {3.508517813506985*^9, 3.5085178265954084`*^9}, 3.5085181349923496`*^9, 3.5085187771362777`*^9, 3.508519858127777*^9, 3.5085246803306475`*^9, 3.508547771449278*^9, 3.508611398220435*^9, 3.508611854986539*^9, {3.5086123794906597`*^9, 3.508612383515467*^9}, 3.5086810214519963`*^9, 3.5086815624609466`*^9, { 3.508681656607912*^9, 3.508681671771139*^9}, {3.5086817119880095`*^9, 3.5086817184932213`*^9}, 3.5086833936709633`*^9, {3.5164638304770374`*^9, 3.516463835983847*^9}, 3.516468478318001*^9, {3.516470970812379*^9, 3.5164709746343856`*^9}, 3.5164894900080414`*^9, 3.516499864293869*^9, 3.516503747156289*^9, {3.5165310341314163`*^9, 3.5165310398410263`*^9}, 3.518963096234722*^9, 3.5189632402249575`*^9, 3.518969718751508*^9, 3.518974982424573*^9, 3.5189828696316957`*^9, 3.5217354385216255`*^9, 3.521740579945902*^9, 3.521747129913966*^9, {3.5217490490753527`*^9, 3.521749063309167*^9}, 3.5217522807442617`*^9, 3.521757775066741*^9, 3.521757946723559*^9, 3.5217590165576196`*^9, {3.5217630044738894`*^9, 3.521763022696932*^9}, 3.521767147327959*^9, 3.5217706333256817`*^9, 3.5217706664913397`*^9, 3.521802507941267*^9, {3.5219368073392572`*^9, 3.521936823298085*^9}, 3.5219378053666105`*^9, 3.521937835895864*^9, { 3.521937888779957*^9, 3.5219378979215727`*^9}, 3.521939152506976*^9, { 3.5219424005596437`*^9, 3.5219424106092186`*^9}, {3.5219820374508944`*^9, 3.521982054470524*^9}, {3.5219888915725327`*^9, 3.521988900854549*^9}, 3.521994318218465*^9, 3.5220012226657915`*^9, 3.5220058474573593`*^9, 3.522008407484671*^9, 3.522013329542192*^9, 3.5220198136623807`*^9, 3.5225046330424414`*^9, {3.5225079639011087`*^9, 3.522507977597933*^9}, 3.522514054486834*^9, 3.522546292917748*^9, 3.522547778629726*^9, 3.522549665186564*^9, 3.5225850770677013`*^9, 3.5225885650022755`*^9, 3.522590930257678*^9, 3.522597838781986*^9, {3.522755913637308*^9, 3.522755924355921*^9}, 3.5237302876553717`*^9, 3.5237305304402027`*^9, 3.528219498530733*^9, 3.5356688839071846`*^9, {3.535670622389838*^9, 3.5356706363362627`*^9}, 3.5356738512682853`*^9, 3.536968210493982*^9, 3.536973614458301*^9, 3.5523192731047506`*^9, 3.552320823537674*^9, 3.5523221923776784`*^9, 3.5523237291644983`*^9, 3.552653533052106*^9, 3.552654154406088*^9, 3.5526551357414117`*^9, {3.5526566379928503`*^9, 3.552656648226468*^9}, 3.558893380160405*^9, 3.5644139675451884`*^9, 3.5644141292706723`*^9, 3.5644146257251577`*^9, {3.5697668987495365`*^9, 3.569766925207183*^9}, 3.5698681932327013`*^9, 3.5817864678181033`*^9, 3.583256431049122*^9, 3.583257286609416*^9, {3.589655788808597*^9, 3.589655798427147*^9}, 3.589655854180336*^9, 3.5896559293626366`*^9}] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Set Image Processing Parameters for Right Channel\ \>", "Subsection", CellChangeTimes->{{3.5015262041968403`*^9, 3.501526233961693*^9}, { 3.5896562350761223`*^9, 3.589656239968402*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Allows", " ", "visualization", " ", "and", " ", "user", " ", "determination", " ", "of", " ", "object", " ", "identification", " ", "parameters", " ", "for", " ", "the", " ", "right", " ", RowBox[{"channel", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"Panel", "[", RowBox[{"Column", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Panel", "[", RowBox[{"Column", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Style", "[", RowBox[{ "\"\\"", ",", "18"}], "]"}], ",", RowBox[{"Grid", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", "MovieIndexRHS", "]"}], ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Length", "[", "MovieLengths", "]"}], ",", "1"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Animator", "[", RowBox[{ RowBox[{"Dynamic", "[", "FramesIndexRHS", "]"}], ",", RowBox[{"{", RowBox[{"1", ",", RowBox[{"MovieLengths", "[", RowBox[{"[", "MovieIndexRHS", "]"}], "]"}], ",", "1"}], "}"}], ",", RowBox[{"Dynamic", "[", "FramesIndexRHS", "]"}], ",", RowBox[{"AnimationRunning", "\[Rule]", "False"}]}], "]"}], ",", RowBox[{"Dynamic", "[", "FramesIndexRHS", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"DiskRadiusListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"1", ",", "5", ",", ".25"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"DiskMagnitudeListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"0.1", ",", "2", ",", ".001"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Animator", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", ".0005"}], "}"}], ",", RowBox[{"Dynamic", "[", RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"AnimationRunning", "\[Rule]", "False"}], ",", RowBox[{"AppearanceElements", "\[Rule]", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}], ",", RowBox[{"Dynamic", "[", RowBox[{"ThresholdListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\"\\"", ",", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"BlurListRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"5", ",", "30", ",", "1"}], "}"}], ",", RowBox[{"Appearance", "\[Rule]", "\"\\""}]}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"Button", "[", RowBox[{"\"\\"", ",", RowBox[{"SetAllMoviesRHS", "[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}]}], "]"}], ",", RowBox[{"Button", "[", RowBox[{ "\"\\"", ",", RowBox[{"SetRemainingFramesRHS", "[", RowBox[{"MovieIndexRHS", ",", "FramesIndexRHS"}], "]"}]}], "]"}]}], "}"}]}], "}"}], ",", RowBox[{"Alignment", "\[Rule]", "Left"}]}], "]"}]}], "}"}], ",", RowBox[{"Alignment", "\[Rule]", "Center"}]}], "]"}], "]"}], ",", RowBox[{"Panel", "[", RowBox[{"LocatorPane", "[", RowBox[{ RowBox[{"Dynamic", "[", RowBox[{"RegionSelectionPointsRHS", "[", RowBox[{"[", RowBox[{"MovieIndexRHS", ",", " ", "FramesIndexRHS"}], "]"}], "]"}], "]"}], ",", "BinarizationImageRHS"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Alignment", "\[Rule]", "Center"}], ",", RowBox[{"ItemSize", "\[Rule]", "Full"}]}], "]"}], "]"}]}]], "Input", CellChangeTimes->{{3.500750882413252*^9, 3.5007509498365707`*^9}, { 3.5085247311087365`*^9, 3.5085247504839706`*^9}, {3.518982981449091*^9, 3.5189829828721724`*^9}, {3.5225851780466795`*^9, 3.5225851784210796`*^9}, {3.5227559855024185`*^9, 3.5227559883895836`*^9}, 3.523730356732293*^9, {3.5896560119913626`*^9, 3.5896560202788363`*^9}}], Cell[BoxData[ PanelBox[ TagBox[GridBox[{ { PanelBox[ TagBox[GridBox[{ { StyleBox["\<\"Determine Parameters for Object Identification\"\>", StripOnInput->False, FontSize->18]}, { TagBox[GridBox[{ {"\<\"Movie Index\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[$CellContext`MovieIndexRHS], {1, 1, 1}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[$CellContext`MovieIndexRHS], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[$CellContext`MovieIndexRHS], {1, 1, 1}]], ""}, {"\<\"Frame Index\"\>", AnimatorBox[Dynamic[$CellContext`FramesIndexRHS], {1, 100, 1}, AnimationRate->Dynamic[$CellContext`FramesIndexRHS], PausedTime->0], DynamicBox[ToBoxes[$CellContext`FramesIndexRHS, StandardForm], ImageSizeCache->{8., {0., 11.}}]}, {"\<\"Disk Radius\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[ Part[$CellContext`DiskRadiusListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], {1, 5, 0.25}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[ Part[$CellContext`DiskRadiusListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[ Part[$CellContext`DiskRadiusListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], {1, 5, 0.25}]], ""}, {"\<\"Disk Magnitude\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[ Part[$CellContext`DiskMagnitudeListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], {0.1, 2, 0.001}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[ Part[$CellContext`DiskMagnitudeListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[ Part[$CellContext`DiskMagnitudeListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], {0.1, 2, 0.001}]], ""}, {"\<\"Threshold\"\>", AnimatorBox[Dynamic[ Part[$CellContext`ThresholdListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], {0, 1, 0.0005}, AnimationRate->Dynamic[ Part[$CellContext`ThresholdListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], AppearanceElements->{ "ProgressSlider", "StepLeftButton", "StepRightButton"}, PausedTime->0], DynamicBox[ToBoxes[ Part[$CellContext`ThresholdListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS], StandardForm], ImageSizeCache->{27., {0., 11.}}]}, {"\<\"Blur Radius\"\>", InterpretationBox[ StyleBox[GridBox[{ { SliderBox[Dynamic[ Part[$CellContext`BlurListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], {5, 30, 1}, Appearance->Automatic, DefaultBaseStyle->"LabeledSlider"], InputFieldBox[Dynamic[ Part[$CellContext`BlurListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], Appearance->"Frameless", ContinuousAction->True, DefaultBaseStyle->"LabeledSlider", FieldSize->{{5, 10}, {1, 2}}, ImageMargins->0]} }, AutoDelete->False, BaselinePosition->{{1, 1}, Axis}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], Deployed->True, StripOnInput->False, FontFamily:>CurrentValue["ControlsFontFamily"]], LabeledSlider[ Dynamic[ Part[$CellContext`BlurListRHS, $CellContext`MovieIndexRHS, \ $CellContext`FramesIndexRHS]], {5, 30, 1}]], ""}, { ButtonBox["\<\"Set All Movies to these Parameters\"\>", Appearance->Automatic, ButtonFunction:>$CellContext`SetAllMoviesRHS[$CellContext`\ MovieIndexRHS, $CellContext`FramesIndexRHS], Evaluator->Automatic, Method->"Preemptive"], ButtonBox["\<\"Set Remaining Frames in this Movie to these \ Parameters\"\>", Appearance->Automatic, ButtonFunction:>$CellContext`SetRemainingFramesRHS[$\ CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS], Evaluator->Automatic, Method->"Preemptive"], ""} }, AutoDelete->False, GridBoxAlignment->{"Columns" -> {{Left}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], "Grid"]} }, DefaultBaseStyle->"Column", GridBoxAlignment->{"Columns" -> {{Center}}}, GridBoxItemSize->{ "Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}], "Column"]]}, { PanelBox[ LocatorPaneBox[Dynamic[ Part[$CellContext`RegionSelectionPointsRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], DynamicBox[ToBoxes[ ImageApply[If[# == 1, {1, 0, 0}, {0, #, 0}]& , ImageAdd[ ImageAdjust[ ImageMultiply[ $CellContext`ImageAlignment[ Import[ Part[$CellContext`MovieFiles, $CellContext`MovieIndexRHS, \ $CellContext`FramesIndexRHS], "TIFF"], $CellContext`MovieIndexRHS, "right", $CellContext`AlignmentParameters], Binarize[ Rasterize[ Graphics[{White, Polygon[ Part[$CellContext`RegionSelectionPointsRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]]}, Background -> Black, PlotRange -> {{0, 512}, {0, 512}}, ImageSize -> {512, 512}], "Image"]]]], Binarize[ ImageMultiply[ ImageConvolve[ ImageSubtract[ $CellContext`ImageAlignment[ Import[ Part[$CellContext`MovieFiles, $CellContext`MovieIndexRHS, \ $CellContext`FramesIndexRHS], "TIFF"], $CellContext`MovieIndexRHS, "right", $CellContext`AlignmentParameters], Blur[ $CellContext`ImageAlignment[ Import[ Part[$CellContext`MovieFiles, $CellContext`MovieIndexRHS, \ $CellContext`FramesIndexRHS], "TIFF"], $CellContext`MovieIndexRHS, "right", $CellContext`AlignmentParameters], Part[$CellContext`BlurListRHS, $CellContext`MovieIndexRHS, \ $CellContext`FramesIndexRHS]]], DiskMatrix[ Part[$CellContext`DiskRadiusListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]] Part[$CellContext`DiskMagnitudeListRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]], Binarize[ Rasterize[ Graphics[{White, Polygon[ Part[$CellContext`RegionSelectionPointsRHS, \ $CellContext`MovieIndexRHS, $CellContext`FramesIndexRHS]]}, Background -> Black, PlotRange -> {{0, 512}, {0, 512}}, ImageSize -> {512, 512}], "Image"]]], Part[$CellContext`ThresholdListRHS, $CellContext`MovieIndexRHS, \ $CellContext`FramesIndexRHS]]]], StandardForm], ImageSizeCache->{310., {316., 323.}}]]]} }, DefaultBaseStyle->"Column", GridBoxAlignment->{"Columns" -> {{Center}}}, GridBoxItemSize->{"Columns" -> {{All}}, "Rows" -> {{All}}}], "Column"]]], "Output", CellChangeTimes->{ 3.5007509713334084`*^9, 3.501429576550787*^9, 3.501440996305046*^9, 3.5014413772889156`*^9, 3.5014414130129786`*^9, 3.5014489375124598`*^9, 3.5014498841181803`*^9, 3.501450605890587*^9, 3.5014510937826614`*^9, 3.5014528442149363`*^9, 3.501454663162531*^9, 3.501457850602866*^9, 3.501463573837025*^9, 3.501469820639474*^9, 3.50147005760389*^9, 3.501526002107685*^9, 3.5060888857710676`*^9, 3.5060948749334497`*^9, 3.5060994950156307`*^9, 3.5061044798643866`*^9, 3.5071732138316083`*^9, 3.508516499360677*^9, 3.508516648512539*^9, 3.508517291264868*^9, 3.5085178669526787`*^9, 3.508518194319254*^9, 3.5085188180083494`*^9, { 3.508519902041854*^9, 3.508519914631076*^9}, {3.508524732419139*^9, 3.5085247702960052`*^9}, 3.508547897917512*^9, 3.5086114425557127`*^9, 3.5086119162478466`*^9, 3.5086124096455135`*^9, 3.508681103617341*^9, 3.508681782359733*^9, 3.5086834279286237`*^9, 3.5164644277552867`*^9, 3.516468543806916*^9, 3.51647101143485*^9, 3.516489537720771*^9, 3.516499925211976*^9, 3.516503819415616*^9, 3.518969890882354*^9, 3.518975025625044*^9, 3.5189829833762016`*^9, 3.5217354898613157`*^9, 3.5217409326524014`*^9, 3.5217471660070305`*^9, 3.521749114983123*^9, 3.5217523342991557`*^9, 3.521757775095742*^9, 3.521758008777108*^9, 3.5217590669054995`*^9, 3.521763042605071*^9, 3.521767221147289*^9, 3.521770703260605*^9, 3.521802547175336*^9, 3.521936807370457*^9, 3.5219368752149763`*^9, 3.52193780541341*^9, 3.521937835942664*^9, 3.5219383666243963`*^9, 3.5219391525381765`*^9, 3.5219424005966454`*^9, 3.5219425874453325`*^9, 3.521982037482094*^9, 3.521982106387415*^9, { 3.521988891603733*^9, 3.521988900885749*^9}, 3.5219943182496643`*^9, 3.522001222696992*^9, 3.5220058474885592`*^9, 3.5220084075206738`*^9, 3.522013329573392*^9, 3.5220198136935806`*^9, 3.522504633089241*^9, { 3.5225079639323087`*^9, 3.5225079696575184`*^9}, 3.5225080174716024`*^9, 3.522514077434474*^9, 3.5225462929467497`*^9, 3.5225477786557274`*^9, 3.5225496652165656`*^9, 3.5225850770989017`*^9, 3.5225851874066954`*^9, 3.5225885650802755`*^9, 3.5225909302888775`*^9, 3.522597838828786*^9, 3.522755913723313*^9, 3.5227559891016245`*^9, 3.523730357465494*^9, 3.523730406917581*^9, 3.523730451738064*^9, {3.5237305220629873`*^9, 3.523730531875405*^9}, 3.528219461636668*^9, 3.5282195183115673`*^9, 3.535668888540393*^9, 3.5356706224210377`*^9, 3.5356706572558994`*^9, 3.535673851300287*^9, 3.5369683342770615`*^9, 3.5369736165019045`*^9, 3.55231934144847*^9, 3.552320825378477*^9, 3.5523221924088783`*^9, 3.5523237291956987`*^9, 3.5526535330989065`*^9, 3.552654157838094*^9, 3.5526551357726116`*^9, 3.5526566482576685`*^9, 3.558893380207206*^9, 3.5644139675919886`*^9, 3.5644141293174725`*^9, 3.564414625787558*^9, { 3.569766898796337*^9, 3.5697669273287864`*^9}, 3.5698681932951016`*^9, 3.5817865120909805`*^9, 3.5832564422811413`*^9, 3.583257290587423*^9, 3.5896560299323883`*^9}] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Process Images and Save Raw Data to Files", "Subsection", CellChangeTimes->{{3.4664472569862366`*^9, 3.4664472665762367`*^9}, { 3.4675658986030436`*^9, 3.467565905371043*^9}}], Cell[BoxData[{ RowBox[{"FrontEndTokenExecute", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ImageProcessingFunction", "[", RowBox[{"RawImage_", ",", "ParameterList_"}], "]"}], ":=", RowBox[{"Binarize", "[", RowBox[{ RowBox[{"ImageMultiply", "[", RowBox[{ RowBox[{"ImageConvolve", "[", RowBox[{ RowBox[{"ImageSubtract", "[", RowBox[{"RawImage", ",", RowBox[{"Blur", "[", RowBox[{"RawImage", ",", RowBox[{"ParameterList", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}], "]"}], ",", RowBox[{ RowBox[{"DiskMatrix", "[", RowBox[{"ParameterList", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}], "*", RowBox[{"ParameterList", "[", RowBox[{"[", "3", "]"}], "]"}]}]}], "]"}], ",", RowBox[{"Binarize", "[", RowBox[{"Rasterize", "[", RowBox[{ RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"White", ",", RowBox[{"Polygon", "[", RowBox[{"ParameterList", "[", RowBox[{"[", "5", "]"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"Background", "\[Rule]", "Black"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "512"}], "}"}]}], "}"}]}], ",", RowBox[{"ImageSize", "\[Rule]", RowBox[{"{", RowBox[{"512", ",", "512"}], "}"}]}]}], "]"}], ",", "\"\\""}], "]"}], "]"}]}], "]"}], ",", RowBox[{"ParameterList", "[", RowBox[{"[", "4", "]"}], "]"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ParameterListLHS", "=", RowBox[{"MapThread", "[", RowBox[{ RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"#1", ",", "#2", ",", "#3", ",", "#4", ",", "#5"}], "}"}], "]"}], "&"}], ",", RowBox[{"{", RowBox[{ "BlurListLHS", ",", "DiskRadiusListLHS", ",", "DiskMagnitudeListLHS", ",", "ThresholdListLHS", ",", "RegionSelectionPointsLHS"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ParameterListRHS", "=", RowBox[{"MapThread", "[", RowBox[{ RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"#1", ",", "#2", ",", "#3", ",", "#4", ",", "#5"}], "}"}], "]"}], "&"}], ",", RowBox[{"{", RowBox[{ "BlurListRHS", ",", "DiskRadiusListRHS", ",", "DiskMagnitudeListRHS", ",", "ThresholdListRHS", ",", "RegionSelectionPointsRHS"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RawObjectDataFilePathLHS", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"#", ",", "\"\\""}], "]"}], "&"}], ",", "DataFilePrefix"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"RawObjectDataFilePathRHS", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"#", ",", "\"\\""}], "]"}], "&"}], ",", "DataFilePrefix"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Set", " ", "output", " ", RowBox[{"directory", "."}]}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"RawObjectDataDirectory", "=", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"SetDirectory", "[", "RawObjectDataDirectory", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Change", " ", "directory", " ", "for", " ", "the", " ", "ParticleTrackingFRET", " ", "library", " ", "file", " ", "in", " ", "the", " ", "line", " ", RowBox[{"below", "."}]}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ParallelEvaluate", "[", RowBox[{"Get", "[", RowBox[{"\"\\"", ",", " ", RowBox[{ "Path", " ", "->", " ", "\"\\""}]}], "]"}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"DistributeDefinitions", "[", RowBox[{ "MovieFiles", ",", "ImageProcessingFunction", ",", "ParameterListLHS", ",", "ParameterListRHS", ",", "AlignmentParameters"}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"TempObjects", "=", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"MovieNumber", "=", "1"}], ",", RowBox[{"MovieNumber", "<", RowBox[{"NumberOfMovies", "+", "1"}]}], ",", RowBox[{"MovieNumber", "++"}], ",", RowBox[{ RowBox[{"TempObjects", "=", RowBox[{"Parallelize", "[", RowBox[{"MapThread", "[", RowBox[{ RowBox[{ RowBox[{"IdentifyAllObjectsOnFrameCentroidFit", "[", RowBox[{ "#1", ",", "ImageProcessingFunction", ",", "#2", ",", "MovieNumber", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}], ",", RowBox[{"ParameterListLHS", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}]}], "}"}]}], "]"}], "]"}]}], ";", RowBox[{"Put", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "3"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "4"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "5"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"RawObjectDataFilePathLHS", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}]}], "]"}]}]}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"TempObjects", "=", RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"MovieNumber", "=", "1"}], ",", RowBox[{"MovieNumber", "<", RowBox[{"NumberOfMovies", "+", "1"}]}], ",", RowBox[{"MovieNumber", "++"}], ",", RowBox[{ RowBox[{"TempObjects", "=", RowBox[{"Parallelize", "[", RowBox[{"MapThread", "[", RowBox[{ RowBox[{ RowBox[{"IdentifyAllObjectsOnFrameCentroidFit", "[", RowBox[{ "#1", ",", "ImageProcessingFunction", ",", "#2", ",", "MovieNumber", ",", "\"\\"", ",", "AlignmentParameters"}], "]"}], "&"}], ",", RowBox[{"{", RowBox[{ RowBox[{"MovieFiles", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}], ",", RowBox[{"ParameterListRHS", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}]}], "}"}]}], "]"}], "]"}]}], ";", RowBox[{"Put", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "3"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "5"}], "]"}], "]"}], ",", RowBox[{"TempObjects", "[", RowBox[{"[", RowBox[{"All", ",", "4"}], "]"}], "]"}]}], "}"}], ",", RowBox[{"RawObjectDataFilePathRHS", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}]}], "]"}]}]}], "]"}], "\[IndentingNewLine]", RowBox[{"FrontEndTokenExecute", "[", "\"\\"", "]"}]}], "Input", CellChangeTimes->{{3.4675645221240435`*^9, 3.4675646906910434`*^9}, 3.467564750897043*^9, {3.477763635361494*^9, 3.477763637982294*^9}, 3.4778294089796*^9, 3.477858279785*^9, {3.496535041181551*^9, 3.4965351888046103`*^9}, {3.496535239567099*^9, 3.4965352629047403`*^9}, { 3.4965353149152317`*^9, 3.496535340858077*^9}, {3.5014350713556385`*^9, 3.5014350721512403`*^9}, {3.501435241629938*^9, 3.501435243501941*^9}, { 3.5014354011090183`*^9, 3.501435415835444*^9}, {3.501436795361467*^9, 3.5014368012114773`*^9}, {3.5014492847653217`*^9, 3.501449312505908*^9}, { 3.501469731173317*^9, 3.5014697340125217`*^9}, {3.5896560769820795`*^9, 3.5896560773351*^9}, {3.5915323293092422`*^9, 3.591532366874108*^9}, { 3.591532401864969*^9, 3.5915324367778296`*^9}}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Step 2: Remove Duplicate Objects in Each Image", "Section", CellChangeTimes->{{3.501464373889907*^9, 3.501464445150832*^9}, { 3.589656125728868*^9, 3.589656127457967*^9}, {3.589827453660153*^9, 3.5898274552922463`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Load", " ", "data", " ", "files", " ", "from", " ", "the", " ", "previous", " ", RowBox[{"step", ".", " ", "Each"}], " ", "data", " ", "file", " ", "should", " ", "end", " ", "with", " ", "\"\\"", " ", "or", " ", "\"\\""}], "*)"}], "\[IndentingNewLine]", RowBox[{"FileNameSetter", "[", RowBox[{ RowBox[{"Dynamic", "[", "ObjectRawDataFiles", "]"}], ",", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.4675660427730436`*^9, 3.4675660510930433`*^9}, { 3.4675661286880436`*^9, 3.467566133951043*^9}, {3.501466312364912*^9, 3.5014663127237124`*^9}, {3.5014691031786137`*^9, 3.501469103490614*^9}, { 3.58965639151507*^9, 3.5896564222838297`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{"The", " ", "parameter"}], ",", " ", RowBox[{ "\"\\"", " ", "defines", " ", "the", " ", "distance", " ", "between", " ", "the", " ", "center", " ", "of", " ", "intensity"}], ",", " ", RowBox[{"in", " ", "units", " ", "of", " ", "pixels"}], ",", " ", RowBox[{ "above", " ", "which", " ", "two", " ", "objects", " ", "will", " ", "be", " ", "treated", " ", "as", " ", "separate", " ", "objects", " ", "in", " ", "the", " ", "two", " ", RowBox[{"channels", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"TestRadius", "=", "3"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SplitFileNames", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"#", ",", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\<1.dat\>\""}], "}"}]}], "]"}], "&"}], ",", "ObjectRawDataFiles"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ExperimentList", "=", RowBox[{ RowBox[{"Tally", "[", RowBox[{"SplitFileNames", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DataMatcher", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Flatten", "[", RowBox[{"Position", "[", RowBox[{"SplitFileNames", ",", RowBox[{"Flatten", "[", RowBox[{"Select", "[", RowBox[{"SplitFileNames", ",", RowBox[{ RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "==", RowBox[{"ExperimentList", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&&", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "\[Equal]", RowBox[{"If", "[", RowBox[{ RowBox[{"k", "\[Equal]", "1"}], ",", "\"\\"", ",", "\"\\""}], "]"}]}]}], "&"}]}], "]"}], "]"}]}], "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "ExperimentList", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"k", ",", "1", ",", "2"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DataDirectory", "=", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"SetDirectory", "[", "DataDirectory", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"DropChooser", "[", RowBox[{"input1_", ",", "input2_"}], "]"}], ":=", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ SuperscriptBox[ RowBox[{"(", FractionBox[ RowBox[{"input1", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], RowBox[{ RowBox[{"input1", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "+", SuperscriptBox["10", RowBox[{"-", "50"}]]}]], ")"}], "2"], "+", SuperscriptBox[ RowBox[{"(", FractionBox[ RowBox[{"input1", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}], RowBox[{ RowBox[{"input1", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], "+", SuperscriptBox["10", RowBox[{"-", "50"}]]}]], ")"}], "2"]}], ")"}], "\[GreaterEqual]", RowBox[{"(", RowBox[{ SuperscriptBox[ RowBox[{"(", FractionBox[ RowBox[{"input2", "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], RowBox[{ RowBox[{"input2", "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "+", SuperscriptBox["10", RowBox[{"-", "50"}]]}]], ")"}], "2"], "+", SuperscriptBox[ RowBox[{"(", FractionBox[ RowBox[{"input2", "[", RowBox[{"[", RowBox[{"2", ",", "2"}], "]"}], "]"}], RowBox[{ RowBox[{"input2", "[", RowBox[{"[", RowBox[{"2", ",", "1"}], "]"}], "]"}], "+", SuperscriptBox["10", RowBox[{"-", "50"}]]}]], ")"}], "2"]}], ")"}]}], ",", "1", ",", "2"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.5001381746800566`*^9, 3.500138215926529*^9}, { 3.501464782111424*^9, 3.5014648007222567`*^9}, 3.5014655739220147`*^9, { 3.5014690996530075`*^9, 3.501469127202656*^9}, {3.5014712689398303`*^9, 3.5014712692206306`*^9}, {3.501471374037215*^9, 3.501471376002818*^9}, { 3.5015151599082394`*^9, 3.5015151600642395`*^9}, {3.501545931896835*^9, 3.501545953190872*^9}, {3.5020332179441605`*^9, 3.5020332216101675`*^9}, { 3.516652639169956*^9, 3.5166526402151575`*^9}, {3.587734619255362*^9, 3.5877346207685647`*^9}, {3.587740194783085*^9, 3.5877401951106853`*^9}, { 3.5877414441824646`*^9, 3.5877414608588934`*^9}, 3.587746569421003*^9, 3.5877478949903255`*^9, {3.589656446425211*^9, 3.5896565260997677`*^9}, { 3.5898273276979485`*^9, 3.589827327993965*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{ "Identifies", " ", "objects", " ", "that", " ", "are", " ", "closer", " ", "than", " ", "the", " ", "test", " ", "radius"}], ",", " ", RowBox[{ "finds", " ", "the", " ", "closest", " ", "object", " ", "to", " ", "each", " ", "in", " ", "the", " ", "opposite", " ", "channel"}], ",", " ", RowBox[{ "then", " ", "makes", " ", "sure", " ", "each", " ", "object", " ", "only", " ", "has", " ", "one", " ", RowBox[{"duplicate", ".", " ", "Then"}], " ", "it", " ", "makes", " ", "a", " ", "list", " ", "of", " ", "objects", " ", "to", " ", "delete", " ", "by", " ", "selecting", " ", "the", " ", "duplicate", " ", "from", " ", "from", " ", "the", " ", "channel", " ", "with", " ", "the", " ", "highest", " ", "relative", " ", RowBox[{"error", ".", " ", "The"}], " ", "parameter", " ", "\"\\"", " ", "is", " ", "the", " ", "number", " ", "of", " ", "kernels", " ", "to", " ", "run", " ", "in", " ", RowBox[{"parallel", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Nkernels", "=", "8"}], ";"}], "\[IndentingNewLine]", RowBox[{"LaunchKernels", "[", "Nkernels", "]"}], "\[IndentingNewLine]", RowBox[{"DistributeDefinitions", "[", RowBox[{ "ExperimentList", ",", "ObjectRawDataFiles", ",", "DataMatcher", ",", "TestRadius", ",", "DropChooser", ",", "SplitFileNames"}], "]"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"experiment", "=", "1"}], ",", RowBox[{"experiment", "\[LessEqual]", RowBox[{"Length", "[", "DataMatcher", "]"}]}], ",", RowBox[{"experiment", "++"}], ",", RowBox[{ RowBox[{"Print", "[", RowBox[{"ExperimentList", "[", RowBox[{"[", "experiment", "]"}], "]"}], "]"}], ";", RowBox[{"DataSorted", "=", RowBox[{"N", "[", RowBox[{"{", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"Get", "[", RowBox[{"ObjectRawDataFiles", "[", RowBox[{"[", "#", "]"}], "]"}], "]"}], "&"}], ",", RowBox[{"DataMatcher", "[", RowBox[{"[", "experiment", "]"}], "]"}]}], "]"}], "}"}], "]"}]}], ";", RowBox[{"breaks", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "+", RowBox[{"Ceiling", "[", RowBox[{ RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}], " ", RowBox[{ RowBox[{"Length", "[", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "1"}], "]"}], "]"}], "]"}], "/", "7"}]}], "]"}]}], ",", RowBox[{"Ceiling", "[", RowBox[{"i", " ", RowBox[{ RowBox[{"Length", "[", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "1"}], "]"}], "]"}], "]"}], "/", "7"}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "7", ",", "1"}], "}"}]}], "]"}]}], ";", RowBox[{"DistributeDefinitions", "[", RowBox[{"DataSorted", ",", "experiment"}], "]"}], ";", RowBox[{"DropList3", "=", RowBox[{"Flatten", "[", RowBox[{ RowBox[{"WaitAll", "[", RowBox[{"{", RowBox[{"Table", "[", RowBox[{ RowBox[{"ParallelSubmit", "[", RowBox[{ RowBox[{"{", "xxx", "}"}], ",", RowBox[{"For", "[", RowBox[{ RowBox[{ RowBox[{"frameindex", "=", RowBox[{"Min", "[", "xxx", "]"}]}], ";", RowBox[{"DropList2", "=", RowBox[{"{", "}"}]}], ";"}], ",", RowBox[{"frameindex", "\[LessEqual]", RowBox[{"Max", "[", "xxx", "]"}]}], ",", RowBox[{"frameindex", "++"}], ",", RowBox[{ RowBox[{"closeobjects", "=", RowBox[{"Select", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", "j", ",", RowBox[{"EuclideanDistance", "[", RowBox[{ RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{ "1", ",", "1", ",", "3", ",", "frameindex", ",", "i"}], "]"}], "]"}], ",", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{ "1", ",", "2", ",", "3", ",", "frameindex", ",", "j"}], "]"}], "]"}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", "1", ",", "frameindex"}], "]"}], "]"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "2", ",", "1", ",", "frameindex"}], "]"}], "]"}], ",", "1"}], "}"}]}], "]"}], ",", "1"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "3", "]"}], "]"}], "<", "TestRadius"}], "&"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"leftpotentialduplicates", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"closeobjects", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], ">", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rightpotentialduplicates", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"closeobjects", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], ">", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"uniques", "=", RowBox[{"DeleteCases", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"Select", "[", RowBox[{"leftpotentialduplicates", ",", RowBox[{ RowBox[{"#", "==", RowBox[{"closeobjects", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}]}], "&"}]}], "]"}], "]"}], "\[GreaterEqual]", "1"}], ",", RowBox[{"{", "}"}], ",", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Length", "[", RowBox[{"Select", "[", RowBox[{"rightpotentialduplicates", ",", RowBox[{ RowBox[{"#", "==", RowBox[{"closeobjects", "[", RowBox[{"[", RowBox[{"i", ",", "2"}], "]"}], "]"}]}], "&"}]}], "]"}], "]"}], "\[GreaterEqual]", "1"}], ",", RowBox[{"{", "}"}], ",", RowBox[{"closeobjects", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "closeobjects", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"leftclosest", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Sort", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"closeobjects", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "\[Equal]", RowBox[{"leftpotentialduplicates", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#1", "[", RowBox[{"[", "3", "]"}], "]"}], "<", RowBox[{"#2", "[", RowBox[{"[", "3", "]"}], "]"}]}], "&"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "leftpotentialduplicates", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rightclosest", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Sort", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"closeobjects", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "\[Equal]", RowBox[{"rightpotentialduplicates", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#1", "[", RowBox[{"[", "3", "]"}], "]"}], "<", RowBox[{"#2", "[", RowBox[{"[", "3", "]"}], "]"}]}], "&"}]}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{ "Length", "[", "rightpotentialduplicates", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"leftuniques", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"leftclosest", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "==", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"leftdoubleduplicates", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"leftclosest", "[", RowBox[{"[", RowBox[{"All", ",", "2"}], "]"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], ">", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"leftuniques2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Select", "[", RowBox[{"rightclosest", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "\[Equal]", RowBox[{"leftdoubleduplicates", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "leftdoubleduplicates", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rightuniques", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"rightclosest", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "==", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rightdoubleduplicates", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"rightclosest", "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], ">", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"rightuniques2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Select", "[", RowBox[{"leftclosest", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "\[Equal]", RowBox[{"rightdoubleduplicates", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "2"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "rightdoubleduplicates", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Duplicates", "=", RowBox[{ RowBox[{"Select", "[", RowBox[{ RowBox[{"Tally", "[", RowBox[{"Flatten", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"rightclosest", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "\[Equal]", RowBox[{"rightuniques", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "rightuniques", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"rightclosest", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "\[Equal]", RowBox[{"rightuniques2", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "rightuniques2", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"leftclosest", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "\[Equal]", RowBox[{"leftuniques", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "leftuniques", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{"Select", "[", RowBox[{"leftclosest", ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "\[Equal]", RowBox[{"leftuniques2", "[", RowBox[{"[", "i", "]"}], "]"}]}], "&"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "leftuniques2", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", "uniques", "}"}]}], "}"}], ",", "2"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "\[Equal]", "1"}], "&"}]}], "]"}], "[", RowBox[{"[", RowBox[{"All", ",", "1", ",", RowBox[{"1", ";;", "2"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"DropList1", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"DropChooser", "[", RowBox[{ RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", RowBox[{"4", ";;", "5"}], ",", "frameindex", ",", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "2", ",", RowBox[{"4", ";;", "5"}], ",", "frameindex", ",", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}], "]"}]}], "]"}], ",", RowBox[{"#", "[", RowBox[{"[", RowBox[{"DropChooser", "[", RowBox[{ RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "1", ",", RowBox[{"4", ";;", "5"}], ",", "frameindex", ",", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}], "]"}], ",", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"1", ",", "2", ",", RowBox[{"4", ";;", "5"}], ",", "frameindex", ",", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}], "]"}]}], "]"}], "]"}], "]"}]}], "}"}], "&"}], ",", "Duplicates"}], "]"}]}], ";", RowBox[{"DropList2temp", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{"1", ",", RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "frameindex", ",", RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}]}], "}"}], "&"}], ",", "DropList1"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"DropList2", ",", "DropList2temp"}], "]"}], ";", RowBox[{"If", "[", RowBox[{ RowBox[{"frameindex", "\[Equal]", RowBox[{"Max", "[", "xxx", "]"}]}], ",", RowBox[{"Return", "[", "DropList2", "]"}]}], "]"}]}]}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"xxx", ",", "breaks"}], "}"}]}], "]"}], "}"}], "]"}], ",", "3"}], "]"}]}], ";", RowBox[{"DataSorted2", "=", RowBox[{"DataSorted", "[", RowBox[{"[", RowBox[{"All", ",", "All", ",", RowBox[{"2", ";;", "5"}]}], "]"}], "]"}]}], ";", RowBox[{"For", "[", RowBox[{ RowBox[{"ii", "=", "1"}], ",", RowBox[{"ii", "\[LessEqual]", RowBox[{"Length", "[", "DropList3", "]"}]}], ",", RowBox[{"ii", "++"}], ",", RowBox[{ RowBox[{ RowBox[{"DataSorted2", "[", RowBox[{"[", RowBox[{ RowBox[{"DropList3", "[", RowBox[{"[", RowBox[{"ii", ",", "1"}], "]"}], "]"}], ",", RowBox[{"DropList3", "[", RowBox[{"[", RowBox[{"ii", ",", "2"}], "]"}], "]"}], ",", "All", ",", RowBox[{"DropList3", "[", RowBox[{"[", RowBox[{"ii", ",", "3"}], "]"}], "]"}], ",", RowBox[{"DropList3", "[", RowBox[{"[", RowBox[{"ii", ",", "4"}], "]"}], "]"}]}], "]"}], "]"}], "=", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}], ";"}]}], "]"}], ";", RowBox[{"DataSorted3", "=", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"Select", "[", RowBox[{"#", ",", RowBox[{ RowBox[{"NumericQ", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{"{", "#", "}"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}], "]"}], "&"}]}], "]"}], "&"}], ",", "DataSorted2", ",", RowBox[{"{", "4", "}"}]}], "]"}]}], ";", RowBox[{"DataCombinedChannels", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"DataSorted3", "[", RowBox[{"[", RowBox[{"expt", ",", "1", ",", "param", ",", "frame"}], "]"}], "]"}], ",", RowBox[{"DataSorted3", "[", RowBox[{"[", RowBox[{"expt", ",", "2", ",", "param", ",", "frame"}], "]"}], "]"}]}], "}"}], ",", "1"}], "]"}], ",", RowBox[{"{", RowBox[{"frame", ",", "1", ",", RowBox[{"Length", "[", RowBox[{"DataSorted3", "[", RowBox[{"[", RowBox[{"expt", ",", "1", ",", "param"}], "]"}], "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"param", ",", "1", ",", "4"}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"expt", ",", "1", ",", "1"}], "}"}]}], "]"}]}], ";", RowBox[{"numberofobjects", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Length", "[", RowBox[{"DataCombinedChannels", "[", RowBox[{"[", RowBox[{"expt", ",", "1", ",", "frame"}], "]"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"frame", ",", "1", ",", RowBox[{"Length", "[", RowBox[{"DataCombinedChannels", "[", RowBox[{"[", RowBox[{"expt", ",", "1"}], "]"}], "]"}], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"expt", ",", "1", ",", "1"}], "}"}]}], "]"}]}], ";", RowBox[{"DataCombinedChannels2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Flatten", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"numberofobjects", "[", RowBox[{"[", "expt", "]"}], "]"}], "}"}], ",", RowBox[{"DataCombinedChannels", "[", RowBox[{"[", "expt", "]"}], "]"}]}], "}"}], ",", "1"}], "]"}], ",", RowBox[{"{", RowBox[{"expt", ",", "1", ",", "1"}], "}"}]}], "]"}]}], ";", RowBox[{"filename", "=", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"StringJoin", "[", RowBox[{"#", ",", "\"\\""}], "]"}], "&"}], ",", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringSplit", "[", RowBox[{"#", ",", RowBox[{"{", "\"\<\\\\\>\"", "}"}]}], "]"}], "[", RowBox[{"[", RowBox[{"-", "1"}], "]"}], "]"}], "&"}], ",", "ExperimentList"}], "]"}]}], "]"}], "[", RowBox[{"[", "experiment", "]"}], "]"}]}], ";", RowBox[{"Put", "[", RowBox[{ RowBox[{"DataCombinedChannels2", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "filename"}], "]"}]}]}], "]"}]}]}]], "Input", CellChangeTimes->{{3.587742241874255*^9, 3.587742289501138*^9}, { 3.5877425996140785`*^9, 3.587742717815485*^9}, {3.5877432203703613`*^9, 3.5877432876220784`*^9}, {3.5877433736718283`*^9, 3.5877434526703663`*^9}, {3.587743662053931*^9, 3.5877436658915377`*^9}, 3.5877439485640306`*^9, {3.587744235713732*^9, 3.5877442454793487`*^9}, 3.5877442820458126`*^9, {3.587744406253229*^9, 3.587744459574122*^9}, { 3.5877449934786534`*^9, 3.5877451460157194`*^9}, {3.587745235185475*^9, 3.5877452593655167`*^9}, {3.58774537557012*^9, 3.587745382527732*^9}, { 3.5877454232126026`*^9, 3.5877454357550244`*^9}, {3.5877461307278376`*^9, 3.5877461426462584`*^9}, {3.587749071887577*^9, 3.5877491122760477`*^9}, { 3.5877491542245207`*^9, 3.5877491547237215`*^9}, {3.5877494516390395`*^9, 3.587749452996242*^9}, {3.5877503670486355`*^9, 3.587750371245043*^9}, { 3.58775352736417*^9, 3.5877535633378325`*^9}, {3.587753645144376*^9, 3.5877536630688066`*^9}, {3.587753751489761*^9, 3.5877537539857655`*^9}, { 3.5877537860750213`*^9, 3.5877539406868906`*^9}, {3.5877539823233633`*^9, 3.587753983711766*^9}, {3.5877540562674923`*^9, 3.587754069511915*^9}, 3.587754111881589*^9, {3.587754161723676*^9, 3.587754235699005*^9}, 3.5877544822690353`*^9, 3.587754594324031*^9, {3.5877557703476815`*^9, 3.587755794621324*^9}, {3.5877558338709927`*^9, 3.5877558575830336`*^9}, 3.587755950964796*^9, {3.5877559878276606`*^9, 3.5877559995432816`*^9}, { 3.587756276459364*^9, 3.587756289500987*^9}, {3.587756615014269*^9, 3.5877566521267333`*^9}, 3.587756798472989*^9, 3.587756901885569*^9, { 3.589656542909729*^9, 3.5896566033171844`*^9}, {3.592361133548976*^9, 3.592361148135001*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Step 3: Single Molecule Tracking\ \>", "Section", CellChangeTimes->{{3.464957251283372*^9, 3.464957280252572*^9}, { 3.4675740732634435`*^9, 3.467574084776243*^9}, 3.4978815597259607`*^9, { 3.5898274569683423`*^9, 3.5898274599115105`*^9}}], Cell[CellGroupData[{ Cell["Import Raw Object Data Files", "Subsection", CellChangeTimes->{{3.468698622994059*^9, 3.468698633957059*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Load", " ", "data", " ", "files", " ", "from", " ", "the", " ", "previous", " ", RowBox[{"step", ".", " ", "Each"}], " ", "data", " ", "file", " ", "should", " ", "end", " ", "with", " ", RowBox[{"\"\<2.dat\>\"", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"FileNameSetter", "[", RowBox[{ RowBox[{"Dynamic", "[", "ObjectRawDataFiles", "]"}], ",", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.4675660427730436`*^9, 3.4675660510930433`*^9}, { 3.4675661286880436`*^9, 3.467566133951043*^9}, {3.589656651459938*^9, 3.5896566528840194`*^9}, {3.5896566887780724`*^9, 3.589656693686353*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Set", " ", "output", " ", "data", " ", "directories", " ", "and", " ", "paths", " ", "for", " ", "ParticleTrackingFRET", " ", "library", " ", "file", " ", RowBox[{"below", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ "AdsorptionDesorptionDataDirectory", "=", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ "ObjectTrackingDataDirectory", "=", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ "FirstFrameTrackingDirectory", "=", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{"Get", "[", RowBox[{"\"\\"", ",", " ", RowBox[{ "Path", " ", "->", " ", "\"\\""}]}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ParallelEvaluate", "[", RowBox[{"Get", "[", RowBox[{"\"\\"", ",", " ", RowBox[{ "Path", " ", "->", " ", "\"\\""}]}], "]"}], "]"}], ";"}]}]}]], "Input", CellChangeTimes->{{3.4686941305236588`*^9, 3.468694162191659*^9}, 3.4686963679222593`*^9, 3.468696477116259*^9, 3.477160994847*^9, { 3.4940752537268248`*^9, 3.4940752586252337`*^9}, 3.494334525587246*^9, 3.4952045383662434`*^9, 3.496515035650362*^9, 3.497886948689727*^9, { 3.5060908683830028`*^9, 3.506090868663803*^9}, {3.5644413565933094`*^9, 3.564441358324912*^9}, {3.589656730677469*^9, 3.589656745745331*^9}, { 3.5896570943932724`*^9, 3.5896570945532813`*^9}, {3.5898267190801373`*^9, 3.589826754807181*^9}, {3.5898270169531746`*^9, 3.5898270195913258`*^9}, { 3.5898273987040095`*^9, 3.5898274063854494`*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["Calculate Tracking Info and Write Data To Files", "Subsection", CellChangeTimes->{{3.468698642577059*^9, 3.468698654180059*^9}, { 3.4960997345669947`*^9, 3.496099741797408*^9}, {3.4978868132394886`*^9, 3.4978868135982895`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{"The", " ", "parameter"}], ",", " ", RowBox[{ "\"\\"", " ", "defines", " ", "the", " ", "distance", " ", "between", " ", "the", " ", "center", " ", "of", " ", "intensity"}], ",", " ", RowBox[{"in", " ", "units", " ", "of", " ", "pixels"}], ",", " ", RowBox[{ "above", " ", "which", " ", "two", " ", "objects", " ", "will", " ", "be", " ", "treated", " ", "as", " ", "separate", " ", "objects", " ", "in", " ", "two", " ", "consecutive", " ", RowBox[{"frames", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"TrackingRadius", "=", "5"}], ";"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"MovieNumber", "=", "1"}], ",", RowBox[{"MovieNumber", "<", RowBox[{ RowBox[{"Length", "[", "ObjectRawDataFiles", "]"}], "+", "1"}]}], ",", RowBox[{"MovieNumber", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Clear", " ", "All", " ", "variables", " ", "and", " ", "import", " ", "raw", " ", "object", " ", "data"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ClearAll", "[", RowBox[{ "ObjectsPerFrame", ",", "MeanRadius", ",", "MeanPositions", ",", "MeanIntensities", ",", "CompMeanIntensities", ",", "MovieFile", ",", "ObjectsThatAdsorbed", ",", "ObjectsThatDesorbed"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"MovieFile", "=", RowBox[{"ObjectRawDataFiles", "[", RowBox[{"[", "MovieNumber", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ "ObjectsPerFrame", ",", "MeanRadius", ",", "MeanPositions", ",", "MeanIntensities", ",", "CompMeanIntensities"}], "}"}], "=", RowBox[{"Get", "[", "MovieFile", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"NumberOfFrames", "=", RowBox[{"Length", "[", "ObjectsPerFrame", "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Distribute", " ", "MeanPositions", " ", "to", " ", "Parallel", " ", "Kernels", " ", "and", " ", "calculate", " ", "objects", " ", "that", " ", "are", " ", "the", " ", "same", " ", "molecule", " ", "between", " ", "adjacent", " ", "frames"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "MovieNumber", "]"}], "<>", "\"\< at day and time of \>\"", "<>", RowBox[{"DateString", "[", "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"DistributeDefinitions", "[", RowBox[{"MeanPositions", ",", "TrackingRadius"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"ObjectsThatStayedFrameToFrameIndex", "=", RowBox[{"ParallelTable", "[", RowBox[{ RowBox[{"ObjectFrameToFrameIndex", "[", RowBox[{ RowBox[{"MeanPositions", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"MeanPositions", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], ",", "TrackingRadius"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{ RowBox[{"Length", "[", "MeanPositions", "]"}], "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Calculate", " ", "objects", " ", "that", " ", "adsorbed", " ", "for", " ", "every", " ", "frame", " ", "of", " ", "the", " ", "movie"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"ObjectsThatAdsorbed", ",", "ObjectsThatDesorbed"}], "}"}], "=", RowBox[{"ObjectAdsorptionDesorption", "[", RowBox[{ "ObjectsThatStayedFrameToFrameIndex", ",", "ObjectsPerFrame"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Distribute", " ", "variables", " ", "to", " ", "parallel", " ", RowBox[{"kernels", ".", " ", "Object"}], " ", "Tracker", " ", "then", " ", "tracks", " ", "molecules", " ", "that", " ", "adsorbed", " ", "using", " ", "Objects", " ", "that", " ", "stayed"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "MovieNumber", "]"}], "<>", "\"\< at day and time of \>\"", "<>", RowBox[{"DateString", "[", "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"DistributeDefinitions", "[", RowBox[{"{", RowBox[{ "ObjectsThatStayedFrameToFrameIndex", ",", "ObjectsThatAdsorbed", ",", "MeanIntensities", ",", "CompMeanIntensities", ",", "MeanRadius", ",", "NumberOfFrames"}], "}"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ "ObjectTrackingData", ",", "ObjectTrackingMeanPositions", ",", "ObjectTrackingMeanIntensities", ",", "ObjectTrackingCompMeanIntensities", ",", "ObjectTrackingRadius"}], "}"}], "=", RowBox[{"ObjectTrackerDataParallel", "[", RowBox[{ "ObjectsThatStayedFrameToFrameIndex", ",", "ObjectsThatAdsorbed", ",", "MeanPositions", ",", "MeanIntensities", ",", "CompMeanIntensities", ",", "MeanRadius", ",", "NumberOfFrames"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "MovieNumber", "]"}], "<>", "\"\< at day and time of \>\"", "<>", RowBox[{"DateString", "[", "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Write", " ", "adsorption", " ", "and", " ", "desorption", " ", "to", " ", "file"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"AdsorptionDesorptionFilePath", "=", RowBox[{"StringReplace", "[", RowBox[{ RowBox[{"Last", "[", RowBox[{"FileNameSplit", "[", "MovieFile", "]"}], "]"}], ",", RowBox[{ "\"\\"", "\[Rule]", "\"\< AdsorptionDesorption\>\""}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"SetDirectory", "[", "AdsorptionDesorptionDataDirectory", "]"}], ";", "\[IndentingNewLine]", RowBox[{"Put", "[", RowBox[{ RowBox[{"{", RowBox[{"ObjectsThatAdsorbed", ",", "ObjectsThatDesorbed"}], "}"}], ",", "AdsorptionDesorptionFilePath"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Write", " ", "object", " ", "tracking", " ", "data", " ", "to", " ", "file"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"ObjectDataFilePath", "=", RowBox[{"StringReplace", "[", RowBox[{ RowBox[{"Last", "[", RowBox[{"FileNameSplit", "[", "MovieFile", "]"}], "]"}], ",", RowBox[{ "\"\\"", "\[Rule]", "\"\< ObjectTrackingData\>\""}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"SetDirectory", "[", "ObjectTrackingDataDirectory", "]"}], ";", "\[IndentingNewLine]", RowBox[{"Put", "[", RowBox[{ RowBox[{"{", RowBox[{ "ObjectTrackingData", ",", "ObjectTrackingMeanPositions", ",", "ObjectTrackingMeanIntensities", ",", "ObjectTrackingCompMeanIntensities", ",", "ObjectTrackingRadius"}], "}"}], ",", "ObjectDataFilePath"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Write", " ", "first", " ", "frame", " ", "object", " ", "tracking", " ", "data", " ", "to", " ", "file"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"FirstFrameObjectDataFilePath", "=", RowBox[{"StringReplace", "[", RowBox[{ RowBox[{"Last", "[", RowBox[{"FileNameSplit", "[", "MovieFile", "]"}], "]"}], ",", RowBox[{ "\"\\"", "\[Rule]", "\"\< FirstFrameObjectTrackingData\>\""}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"SetDirectory", "[", "FirstFrameTrackingDirectory", "]"}], ";", RowBox[{"Put", "[", RowBox[{ RowBox[{"FirstFrameObjectTrackerData", "[", RowBox[{ "ObjectsThatStayedFrameToFrameIndex", ",", "ObjectsPerFrame", ",", "MeanPositions", ",", "MeanIntensities", ",", "CompMeanIntensities", ",", "MeanRadius", ",", "NumberOfFrames"}], "]"}], ",", "FirstFrameObjectDataFilePath"}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]}]], "Input", CellChangeTimes->CompressedData[" 1:eJwd0E8oQwEAx/H5E82BsllatLBQpC128KdsS/4UpWlbYxTZDsQU5UKh5mIl l2f+H5bNn7eYg2WJyNwkacprrZWpeYbVK1b+zPu9w7fP/Vs0YNGYUnk8XiEb jBmYHyKbVsmUsl/YG1ekLbMeZCY4O73tfHj2PZYNryf3BLDWWV8Ai2ebS+Ax qSyDtte/CthjuqmETSnCekjobhvhQsRvhs7QxTDs6x90QEY67YK56k03nLnP P4EJwnAO70kvJxNM+uGXdPUFFmzOvUFxOBqHo9WRPDurMFAhh1etp0pYtyZo g9bAiBXSTws2mB6VbMHSoM4J3/nJfai9C7ihRmhLX2E1SswZULO4UwOpZ70C iqdcaujI+ua89Eg7YISScUaN5U9wu/sjBuMU5TnMYT9VtRzB4rBl/kdAq0Sh CU7tUojYENEq8lNvhzr53joUrXZtQR8zvguHHqUkdDd0iH1ntOohquX8B4Md 5NM= "]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Step 4: Import Object Tracking Files for Analysis", "Section", CellChangeTimes->{{3.468697842544059*^9, 3.468697846560059*^9}, 3.58965476170385*^9, {3.5898260083644867`*^9, 3.58982601139266*^9}, { 3.589827473906311*^9, 3.589827475710414*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{"Load", " ", "results", " ", "of", " ", "2"}], "-", RowBox[{"channel", " ", "image", " ", RowBox[{"processing", ".", " ", "Each"}], " ", "data", " ", "file", " ", "should", " ", "end", " ", "with", " ", "\"\\"", " ", "and", " ", "tracking", " ", "files", " ", "from", " ", "multiple", " ", "movies", " ", "can", " ", "be", " ", "loaded", " ", RowBox[{"simultaneously", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"FileNameSetter", "[", RowBox[{ RowBox[{"Dynamic", "[", "ObjectTrackingDataFiles", "]"}], ",", " ", "\"\\""}], "]"}]}]], "Input", CellChangeTimes->{{3.4675660427730436`*^9, 3.4675660510930433`*^9}, { 3.4675661286880436`*^9, 3.467566133951043*^9}, {3.468697885328059*^9, 3.468697889568059*^9}, {3.4979234580498323`*^9, 3.4979234593602347`*^9}, 3.58965476170385*^9, {3.58982609322134*^9, 3.589826101708826*^9}, { 3.5898261807313457`*^9, 3.589826250173318*^9}, {3.591532675957447*^9, 3.5915327040062957`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "ObjectTrackingData", ",", " ", "TrajectoryMeanPositions", ",", " ", "TrajectoryLHSIntensities", ",", "TrajectoryRHSIntensities", ",", " ", RowBox[{ "and", " ", "TrajectoryTrackingRadius", " ", "are", " ", "all", " ", "matrices", " ", "of", " ", "different", " ", "trajectory", " ", RowBox[{"properties", ".", " ", "The"}], " ", "matrix", " ", "is", " ", "structured", " ", "so", " ", "the", " ", "first", " ", "level", " ", "groups", " ", "all", " ", "trajectories", " ", "by", " ", "the", " ", "movie", " ", "from", " ", "which", " ", "they", " ", "were", " ", RowBox[{"generated", ".", " ", "Each"}], " ", "element", " ", "of", " ", "the", " ", "second", " ", "level", " ", "is", " ", "a", " ", "list", " ", "of", " ", "the", " ", RowBox[{"object", "'"}], "s", " ", "properties", " ", "in", " ", "each", " ", "consecutive", " ", "frame", " ", "in", " ", "which", " ", "the", " ", "object", " ", "was", " ", RowBox[{"observed", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Each", " ", "element", " ", "of", " ", "the", " ", "second", " ", "level", " ", "of", " ", "ObjectTrackingData", " ", "gives", " ", "the", " ", "frame", " ", "on", " ", "which", " ", "that", " ", "object", " ", "was", " ", "identified", " ", "followed", " ", "by", " ", "a", " ", "unique", " ", "number", " ", "that", " ", "identifies", " ", "that", " ", "object", " ", "in", " ", "the", " ", RowBox[{"frame", "."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ "Each", " ", "element", " ", "of", " ", "the", " ", "second", " ", "level", " ", "of", " ", "TrajectoryMeanPositions", " ", "gives", " ", "the", " ", "x"}], "-", RowBox[{ "y", " ", "position", " ", "of", " ", "the", " ", "centroid", " ", "of", " ", "intensity", " ", "in", " ", "units", " ", "of", " ", RowBox[{"pixels", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ "Each", " ", "element", " ", "of", " ", "the", " ", "second", " ", "level", " ", "of", " ", "TrajectoryLHSIntensities", " ", "gives", " ", "the", " ", "integrated", " ", "and", " ", "background", " ", "subtracted", " ", "intensity", " ", "in", " ", "the", " ", "left"}], "-", RowBox[{ "hand", " ", "channel", " ", "in", " ", "arbitrary", " ", "units", " ", "followed", " ", "by", " ", "the", " ", "uncertainty", " ", "of", " ", "this", " ", RowBox[{"value", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ "Each", " ", "element", " ", "of", " ", "the", " ", "second", " ", "level", " ", "of", " ", "TrajectoryRHSIntensities", " ", "gives", " ", "the", " ", "integrated", " ", "and", " ", "background", " ", "subtracted", " ", "intensity", " ", "in", " ", "the", " ", "right"}], "-", RowBox[{ "hand", " ", "channel", " ", "in", " ", "arbitrary", " ", "units", " ", "followed", " ", "by", " ", "the", " ", "uncertainty", " ", "of", " ", "this", " ", RowBox[{"value", "."}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ "Each", " ", "element", " ", "of", " ", "the", " ", "second", " ", "level", " ", "of", " ", "TrajectoryTrackingRadius", " ", "reports", " ", "a", " ", "number"}], ",", " ", SqrtBox[ RowBox[{"N", "/", "\[Pi]"}]], ",", " ", RowBox[{ "where", " ", "N", " ", "is", " ", "the", " ", "number", " ", "of", " ", "contiguous", " ", "pixels", " ", "identified", " ", "as", " ", "the", " ", "object", " ", "in", " ", "Step", " ", "1."}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Example", ":", " ", RowBox[{ RowBox[{ RowBox[{"TrajectoryMeanPositions", "[", RowBox[{"[", RowBox[{"2", ",", "154"}], "]"}], "]"}], " ", "will", " ", "return", " ", "a", " ", "list", " ", "of", " ", "the", " ", "x"}], "-", RowBox[{ "y", " ", "positions", " ", "of", " ", "the", " ", "154", "th", " ", "trajectory", " ", "of", " ", "the", " ", "second", " ", RowBox[{"movie", "."}]}]}]}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"{", RowBox[{ "ObjectTrackingData", ",", " ", "TrajectoryMeanPositions", ",", " ", "TrajectoryLHSIntensities", ",", "TrajectoryRHSIntensities", ",", " ", "TrajectoryTrackingRadius"}], "}"}], " ", "=", " ", RowBox[{"Transpose", "[", RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"Get", "[", "#", "]"}], " ", "&"}], ",", " ", "ObjectTrackingDataFiles"}], "]"}], "]"}]}], ";"}]}]], "Input", CellChangeTimes->{{3.4675729620183434`*^9, 3.4675729696311436`*^9}, { 3.468697927646059*^9, 3.468697931085059*^9}, {3.4961528160676317`*^9, 3.496152839717273*^9}, {3.5001411934693594`*^9, 3.5001411958093634`*^9}, { 3.5001430725866604`*^9, 3.500143073709862*^9}, {3.5015186193499165`*^9, 3.501518631970339*^9}, {3.5015187289529095`*^9, 3.5015187385625267`*^9}, { 3.5015187801989994`*^9, 3.5015187804798*^9}, {3.501521264973364*^9, 3.501521276548584*^9}, {3.5015213246590686`*^9, 3.501521328231475*^9}, { 3.501776495725791*^9, 3.5017765031514044`*^9}, 3.5305838005058737`*^9, 3.5305838360115356`*^9, {3.530621531304194*^9, 3.5306215419746127`*^9}, { 3.530621677772851*^9, 3.530621682172059*^9}, {3.5306241856540575`*^9, 3.5306241865276585`*^9}, {3.5306244953458014`*^9, 3.530624500431411*^9}, { 3.532907558907033*^9, 3.5329075699986525`*^9}, {3.53456228966346*^9, 3.5345622911295443`*^9}, 3.58965476170485*^9, {3.5896548383392334`*^9, 3.5896548509959574`*^9}, {3.5898260329838953`*^9, 3.5898260497788553`*^9}, {3.591532592434901*^9, 3.5915326650062275`*^9}, { 3.5915327193411226`*^9, 3.591532719512723*^9}, {3.591532758762391*^9, 3.5915328659657784`*^9}, {3.591532915823465*^9, 3.5915330986245832`*^9}, { 3.5915331552994823`*^9, 3.5915332849669085`*^9}, {3.591533422403148*^9, 3.591533686870409*^9}, {3.591533730722086*^9, 3.5915337610173388`*^9}}] }, Closed]] }, Open ]] }, AutoGeneratedPackage->None, WindowSize->{1904, 945}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, ShowSelection->True, Magnification:>FEPrivate`If[ FEPrivate`Equal[FEPrivate`$VersionNumber, 6.], 1.25, 1.25 Inherited], FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (November 20, 2012)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 361, 6, 120, "Title"], Cell[CellGroupData[{ Cell[953, 32, 196, 3, 88, "Section"], Cell[1152, 37, 2845, 48, 180, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[4034, 90, 128, 3, 88, "Section"], Cell[CellGroupData[{ Cell[4187, 97, 171, 2, 57, "Subsection"], Cell[4361, 101, 4821, 119, 375, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[9219, 225, 167, 2, 57, "Subsection"], Cell[9389, 229, 19197, 412, 925, "Input"], Cell[28589, 643, 1968, 37, 72, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[30594, 685, 271, 5, 43, "Subsection"], Cell[30868, 692, 39811, 1012, 2245, "Input"], Cell[CellGroupData[{ Cell[70704, 1708, 9014, 176, 347, "Input"], Cell[79721, 1886, 24389, 454, 1305, "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[104159, 2346, 198, 4, 43, "Subsection"], Cell[CellGroupData[{ Cell[104382, 2354, 7102, 149, 347, "Input"], Cell[111487, 2505, 15387, 332, 1305, "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[126923, 2843, 184, 2, 43, "Subsection"], Cell[127110, 2847, 8976, 231, 705, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[136135, 3084, 231, 3, 50, "Section"], Cell[136369, 3089, 778, 16, 58, "Input"], Cell[137150, 3107, 5737, 148, 234, "Input"], Cell[142890, 3257, 29319, 657, 894, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[172246, 3919, 255, 5, 88, "Section"], Cell[CellGroupData[{ Cell[172526, 3928, 116, 1, 57, "Subsection"], Cell[172645, 3931, 704, 15, 72, "Input"], Cell[173352, 3948, 1847, 41, 182, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[175236, 3994, 239, 3, 43, "Subsection"], Cell[175478, 3999, 9614, 209, 1090, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[185141, 4214, 256, 3, 50, "Section"], Cell[185400, 4219, 1103, 21, 72, "Input"], Cell[186506, 4242, 6234, 121, 352, "Input"] }, Closed]] }, Open ]] } ] *) (* End of internal cache information *)