コード例 #1
0
ファイル: BaseDetection.cs プロジェクト: cyrenaique/HCSA
        /// <summary> 3D connected components detector
        /// Computes various information on the detected objects
        /// </summary>
        /// <param name="labeledInputimage">Gray level input image (background value must be 0)</param>
        /// <param name="labeledOutputImage">Empty input image of same size that labeledInput image (can be null)</param>
        /// <param name="image">Original greyscale image (can be null)</param>
        /// <param name="band">the image band</param>
        /// <param name="connectivity">Connectivity. MUST be 6 or 26</param>
        /// <param name="minVolume">Minimum object volume to consider</param>
        /// <param name="maxVolume">Maximum object volume to consider</param>
        public ConnectedComponentSet(cImage labeledInputimage, cImage labeledOutputImage, cImage image, int band, eConnectivity connectivity, float minVolume, float maxVolume)
        {
            if (image != null && (image.Width != labeledInputimage.Width || image.Height != labeledInputimage.Height || image.Depth != labeledInputimage.Depth))
            {
                if (connectivity == eConnectivity.THREED_6 || connectivity == eConnectivity.THREED_26)
                {
                    //  throw new DescriptorException("Uncompatible Image sizes");
                }
            }

            if (labeledOutputImage != null && (labeledOutputImage.Width != labeledInputimage.Width || labeledOutputImage.Height != labeledInputimage.Height || labeledOutputImage.Depth != labeledInputimage.Depth))
            {
                if (connectivity == eConnectivity.THREED_6 || connectivity == eConnectivity.THREED_26)
                {
                    // throw new DescriptorException("Uncompatible Image sizes");
                }
                if (labeledOutputImage.GetNumChannels() != 1)
                {
                    //  throw new DescriptorException("Output label image must be single band");
                }
            }

            if (labeledInputimage.Depth == 1)
            {
                if (connectivity == eConnectivity.THREED_6 || connectivity == eConnectivity.THREED_26)
                {
                    //  throw new DescriptorException("Given connectivity is incompatible with the image depth");
                }
            }
            else if (connectivity == eConnectivity.TWOD_4 || connectivity == eConnectivity.TWOD_8 || connectivity == eConnectivity.TWOD_24)
            {
                //  throw new DescriptorException("Given connectivity is incompatible with the image depth");
            }

            this.min = minVolume;
            this.max = maxVolume;
            this.connectivity = connectivity;
            this.width = labeledInputimage.Width;
            this.height = labeledInputimage.Height;
            this.depth = labeledInputimage.Depth;
            this.scanSliceSize = width * height;
            this.twoTimesWidth = 2 * width;

            if (labeledOutputImage == null)
            {
                this.labeledOutputImage = new cImage(labeledInputimage.Width, labeledInputimage.Height, labeledInputimage.Depth, 1);
            }
            else
            {
                this.labeledOutputImage = labeledOutputImage;
            }
            this.labeledOutput = this.labeledOutputImage.SingleChannelImage[0].Data;
            this.labeledInputimage = labeledInputimage;
            this.labeledInput = labeledInputimage.SingleChannelImage[band].Data;
            this.image = image;

            FindConnectedComponents();
        }
コード例 #2
0
ファイル: BaseDetection.cs プロジェクト: cyrenaique/HCSA
 protected VoxelList(int label, cImage labeledImage, cImage image, eConnectivity connectivity)
 {
     this.label = label;
     surfacePoints = new List<int[]>();
     points = new List<int[]>();
     indices = new List<int>();
     values = new List<float[]>();
     this.labeledImage = labeledImage;
     this.labeledImageData = labeledImage.SingleChannelImage[0].Data;
     this.image = image;
     if (image != null)
     {
         int NumChannels = image.GetNumChannels();
         this.numBands = NumChannels;
         this.intensity = new float[NumChannels];
         this.surfaceIntensity = new float[NumChannels];
         this.maxIntensity = new float[NumChannels];
         this.minIntensity = new float[NumChannels];
         for (int b = 0; b < NumChannels; b++)
         {
             maxIntensity[b] = float.MinValue;
             minIntensity[b] = float.MaxValue;
         }
     }
     this.imageWidth = labeledImage.Width;
     this.imageHeight = labeledImage.Height;
     this.imageDepth = labeledImage.Depth;
     this.scanSliceSize = labeledImage.SliceSize;
     this.connectivity = connectivity;
 }
コード例 #3
0
ファイル: BaseDetection.cs プロジェクト: cyrenaique/HCSA
 internal ConnectedVoxels(int label, cImage labeledImage, cImage image, eConnectivity connectivity)
     : base(label, labeledImage, image, connectivity)
 {
 }
コード例 #4
0
ファイル: BaseDetection.cs プロジェクト: cyrenaique/HCSA
 /// <summary> 3D connected components detector
 /// Computes various information on the detected objects
 /// </summary>
 /// <param name="labeledInputimage">Gray level input image (background value must be 0)</param>
 /// <param name="band">the image band</param>
 /// <param name="connectivity">Connectivity. MUST be 6 or 26</param>
 /// <param name="minVolume">Minimum object volume to consider</param>
 /// <param name="maxVolume">Maximum object volume to consider</param>
 public ConnectedComponentSet(cImage labeledInputimage, int band, eConnectivity connectivity, float minVolume, float maxVolume)
     : this(labeledInputimage, null, null, band, connectivity, minVolume, maxVolume)
 {
 }
コード例 #5
0
ファイル: BaseDetection.cs プロジェクト: cyrenaique/HCSA
        /// <summary>
        /// Grab a set of already computed ConnectedComponent into a ConnectedComponentSet
        /// </summary>
        /// <param name="list">The list of ConnectedComponent</param>
        public ConnectedComponentSet(List<ConnectedVoxels> list)
        {
            /// TO DO: CHECK THE CONSISTENCY OF THE LABELOUTPUT IMAGE AND THE IMAGE WITH THE ACUAL
            /// VALUES OF THE CONNECTED COMPONENTS

            if (list.Count == 0)
                return;

            this.image = list[0].Image;
            this.labeledOutputImage = list[0].LabelImage;
            this.connectivity = list[0].Connectivity;
            this.width = labeledOutputImage.Width;
            this.height = labeledOutputImage.Height;
            this.scanSliceSize = labeledOutputImage.SliceSize;
            this.twoTimesWidth = 2 * this.width;

            int i = 0;
            cc = new ConnectedVoxels[list.Count];
            foreach (ConnectedVoxels cci in list)
            {
                if (cci.LabelImage != labeledOutputImage)
                    throw new ArgumentException("Connected components were not defined from the same image");
                if (cci.Connectivity != connectivity)
                    throw new ArgumentException("Connected components were not defined with the same connectivity");
                cc[i++] = cci;
            }
        }
コード例 #6
0
ファイル: BaseDetection.cs プロジェクト: cyrenaique/HCSA
 public Component(int label, cImage labeledImage, cImage image, eConnectivity connectivity)
     : base(label, labeledImage, image, connectivity)
 {
 }