Example #1
0
        /// <summary>
        /// Analyse image file - crop with tracking, copy Polygonal ROI, apply Sobel operator and save the results
        /// </summary>
        /// <param name="DirData">Output and input directories </param>
        /// <returns>True if file successfully processed</returns>
        public static bool Analyse(FileDirData DirData, double[] background)
        {
            TifFileInfo fi = new TifFileInfo();
            // try
            {
                //read celltool 3 image
                var console = Console.Out;
                Console.SetOut(TextWriter.Null);
                Console.SetError(TextWriter.Null);

                fi = Cell_Tool_3.FileDecoder.ReadImage(DirData.InputDir); //read the image
                Cell_Tool_3.FileDecoder.LoadRoiSet(DirData.InputRoi, fi); //read roi file

                Console.SetOut(console);
                Console.SetError(console);
                int curInd = 1;
                if (fi.roiList != null && fi.roiList[0] != null)
                {
                    foreach (ROI roi in fi.roiList[0])
                    {
                        if (roi.Checked && roi.Type == 1 && roi.Shape > 1)
                        {
                            FileDirData curDirData = DirData.Duplicate();

                            if (!curDirData.InputDir.EndsWith("_CompositeRegistred.tif") &&
                                !curDirData.InputDir.EndsWith("_Q2.tif") &&
                                !curDirData.InputDir.EndsWith("_1.tif"))
                            {
                                curDirData.ExtractClipNumber();
                                curDirData.AddCellIndex(curInd.ToString());
                            }


                            ProcessSingleRoi(fi, roi, curDirData, background);
                        }


                        curInd++;
                    }
                }

                //clear and report
                fi.Delete();
                return(true);
            }
            //catch
            {
                //clear and report
                fi.Delete();
                return(false);
            }
        }