示例#1
0
        private void FI_reduseC(CellToolDK.TifFileInfo fi)
        {
            List <Color> l = new List <Color>();

            for (int i = 0; i < fi.sizeC; i++)
            {
                if (i < fi.LutList.Count)
                {
                    l.Add(fi.LutList[i]);
                }
                else
                {
                    l.Add(System.Drawing.Color.White);
                }
            }

            fi.LutList = l;

            fi.cValue = 0;

            #region Segmentation variables
            fi.histogramArray        = null;
            fi.adjustedLUT           = null;
            fi.MaxBrightness         = null;
            fi.MinBrightness         = null;
            fi.SegmentationCBoxIndex = new int[fi.sizeC];
            fi.SegmentationProtocol  = new int[fi.sizeC];
            fi.thresholdsCBoxIndex   = new int[fi.sizeC];
            fi.sumHistogramChecked   = new bool[fi.sizeC];
            fi.thresholdValues       = new int[fi.sizeC][];
            fi.thresholdColors       = new Color[fi.sizeC][];
            fi.RefThresholdColors    = new Color[fi.sizeC][];
            fi.thresholds            = new int[fi.sizeC];
            fi.SpotColor             = new Color[fi.sizeC];
            fi.RefSpotColor          = new Color[fi.sizeC];
            fi.SelectedSpotThresh    = new int[fi.sizeC];
            fi.SpotThresh            = new int[fi.sizeC];
            fi.typeSpotThresh        = new int[fi.sizeC];
            fi.SpotTailType          = new string[fi.sizeC];
            fi.spotSensitivity       = new int[fi.sizeC];
            fi.roiList          = new List <CellToolDK.ROI> [fi.sizeC];
            fi.tracking_MaxSize = new int[fi.sizeC];
            fi.tracking_MinSize = new int[fi.sizeC];
            fi.tracking_Speed   = new int[fi.sizeC];
            for (int i = 0; i < fi.sizeC; i++)
            {
                fi.sumHistogramChecked[i] = false;
                fi.thresholdValues[i]     = new int[5];
                fi.thresholdColors[i]     = new Color[]
                { Color.Transparent, Color.Transparent, Color.Transparent, Color.Transparent, Color.Transparent };
                fi.RefThresholdColors[i] = new Color[]
                { Color.Black, Color.Orange, Color.Green, Color.Blue, Color.Magenta };
                fi.SpotColor[i]        = Color.Red;
                fi.RefSpotColor[i]     = Color.Red;
                fi.SpotTailType[i]     = "<";
                fi.spotSensitivity[i]  = 100;
                fi.tracking_MaxSize[i] = 10000;
                fi.tracking_MinSize[i] = 5;
                fi.tracking_Speed[i]   = 5;
            }
            #endregion Segmentation variables
        }
示例#2
0
        private void CellToolDKtoFI(CellToolDK.TifFileInfo fi, TifFileInfo oldFI)
        {
            if (fi == null)
            {
                oldFI = null;
                return;
            }

            TifFileInfo newFI = oldFI;

            newFI.zoom      = fi.zoom;
            newFI.Xposition = fi.Xposition;
            newFI.Yposition = fi.Yposition;
            //Chart
            newFI.xAxisTB = fi.xAxisTB;
            newFI.yAxisTB = fi.yAxisTB;

            //Tracking
            newFI.tracking_MaxSize = fi.tracking_MaxSize;
            newFI.tracking_MinSize = fi.tracking_MinSize;
            newFI.tracking_Speed   = fi.tracking_Speed;
            /// <summary>
            /// Segmentation
            /// </summary>
            //filter history
            newFI.FilterHistory = fi.FilterHistory;
            //controls
            newFI.DataSourceInd         = fi.DataSourceInd;
            newFI.SegmentationProtocol  = fi.SegmentationProtocol;
            newFI.SegmentationCBoxIndex = fi.SegmentationCBoxIndex;
            newFI.thresholdsCBoxIndex   = fi.thresholdsCBoxIndex;
            newFI.sumHistogramChecked   = fi.sumHistogramChecked;
            //spotdetector controls
            newFI.SpotThresh         = fi.SpotThresh;
            newFI.SpotColor          = fi.SpotColor;
            newFI.RefSpotColor       = fi.RefSpotColor;
            newFI.SelectedSpotThresh = fi.SelectedSpotThresh;
            newFI.typeSpotThresh     = fi.typeSpotThresh;
            newFI.SpotTailType       = fi.SpotTailType;
            newFI.spotSensitivity    = fi.spotSensitivity;
            //specific values
            newFI.thresholds         = fi.thresholds;
            newFI.thresholdValues    = fi.thresholdValues;
            newFI.thresholdColors    = fi.thresholdColors;
            newFI.RefThresholdColors = fi.RefThresholdColors;
            //BandC
            newFI.autoDetectBandC = fi.autoDetectBandC;
            newFI.applyToAllBandC = fi.applyToAllBandC;
            //
            newFI.selectedPictureBoxColumn = fi.selectedPictureBoxColumn;
            //History
            newFI.History      = fi.History;
            newFI.HistoryPlace = fi.HistoryPlace;
            newFI.undo         = fi.undo;
            newFI.redo         = fi.redo;
            newFI.delHist      = fi.delHist;
            //info var
            newFI.frame    = fi.frame;
            newFI.zValue   = fi.zValue;
            newFI.cValue   = fi.cValue;
            newFI.original = fi.original;
            //Not available
            newFI.loaded       = fi.loaded;
            newFI.available    = fi.available;
            newFI.selected     = fi.selected;
            newFI.openedImages = fi.openedImages;
            //tif image
            newFI.image8bit        = fi.image8bit;
            newFI.image16bit       = fi.image16bit;
            newFI.image8bitFilter  = fi.image8bitFilter;
            newFI.image16bitFilter = fi.image16bitFilter;
            //tif tags
            newFI.Dir                         = fi.Dir;
            newFI.seriesCount                 = fi.seriesCount;
            newFI.imageCount                  = fi.imageCount;
            newFI.sizeX                       = fi.sizeX;
            newFI.sizeY                       = fi.sizeY;
            newFI.sizeZ                       = fi.sizeZ;
            newFI.umZ                         = fi.umZ;
            newFI.umXY                        = fi.umXY;
            newFI.sizeC                       = fi.sizeC;
            newFI.sizeT                       = fi.sizeT;
            newFI.bitsPerPixel                = fi.bitsPerPixel;
            newFI.dimensionOrder              = fi.dimensionOrder;
            newFI.pixelType                   = fi.pixelType;
            newFI.FalseColored                = fi.FalseColored;
            newFI.isIndexed                   = fi.isIndexed;
            newFI.MetadataComplete            = fi.MetadataComplete;
            newFI.DatasetStructureDescription = fi.DatasetStructureDescription;
            newFI.LutList                     = fi.LutList;
            newFI.TimeSteps                   = fi.TimeSteps;
            newFI.Micropoint                  = fi.Micropoint;
            //Metadata protocol info
            newFI.FileDescription = fi.FileDescription;
            newFI.xCompensation   = fi.xCompensation;
            newFI.yCompensation   = fi.yCompensation;
            //properties
            newFI.histogramArray = fi.histogramArray;
            newFI.MinBrightness  = fi.MinBrightness;
            newFI.MaxBrightness  = fi.MaxBrightness;
            newFI.adjustedLUT    = fi.adjustedLUT;
            //RoiManager
            newFI.roiList = new List <ROI> [fi.roiList.Length];
            for (int c = 0; c < fi.roiList.Length; c++)
            {
                if (fi.roiList[c] != null)
                {
                    newFI.roiList[c] = new List <ROI>();
                    foreach (CellToolDK.ROI roi in fi.roiList[c])
                    {
                        ROI newROI = CellToolDKtoROI(roi);
                        newFI.roiList[c].Add(newROI);
                        RoiMeasure.Measure(newROI, newFI, c, IA);
                    }
                }
            }

            newFI.ROICounter = fi.ROICounter;
        }
示例#3
0
        private void PlugIn_Load(string path)
        {
            TifFileInfo oldFI = null;

            try
            {
                oldFI = IA.TabPages.TabCollections[IA.TabPages.SelectedIndex].tifFI;
            }
            catch { }


            CellToolDK.TifFileInfo fi = FItoCellToolDK(oldFI);

            var DLL = Assembly.LoadFile(path);

            foreach (Type type in DLL.GetExportedTypes())
            {
                try
                {
                    Transmiter e = new Transmiter();

                    e.Changed += new TransmiterEventHandler(delegate(object o, TransmiterEventArgs a)
                    {
                        try
                        {
                            if (fi != null && oldFI != null)
                            {
                                if (fi.sizeC != oldFI.sizeC)
                                {
                                    oldFI.sizeC = fi.sizeC;
                                    FI_reduseC(fi);
                                    FI_reduseC(oldFI);
                                }

                                CellToolDKtoFI(fi, oldFI);

                                if (oldFI.sizeZ > 1)
                                {
                                    IA.TabPages.zTrackBar.Refresh(oldFI.zValue + 1, 1, oldFI.sizeZ);
                                    IA.TabPages.zTrackBar.Panel.Visible = true;
                                }
                                else
                                {
                                    IA.TabPages.zTrackBar.Panel.Visible = false;
                                }

                                if (oldFI.sizeT > 1)
                                {
                                    IA.TabPages.tTrackBar.Refresh(oldFI.frame + 1, 1, oldFI.sizeT);
                                    IA.TabPages.tTrackBar.Panel.Visible = true;
                                }
                                else
                                {
                                    IA.TabPages.tTrackBar.Panel.Visible = false;
                                }
                            }
                        }
                        catch { MessageBox.Show("Error with reporting back!"); }

                        IA.ReloadImages();
                    });

                    var c = Activator.CreateInstance(type);

                    try
                    {
                        type.InvokeMember("Input", BindingFlags.InvokeMethod, null, c, new object[] { fi, e });
                    }
                    catch { MessageBox.Show("Input void is not avaliable!"); }
                    break;
                }
                catch { }
            }
        }