public cImage GetMontage() { cImage MyIm = new cImage((int)this.MontageDimensions.X, (int)this.MontageDimensions.Y, (int)this.MontageDimensions.Z,this.NumberOfChannels); MyIm.Resolution = new cPoint3D(this.Resolution); return MyIm; }
/// <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(); }
public cFeedBackMessage Run() { if (this.Input == null) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "No input data defined."; return FeedBackMessage; } this.OutPut = new cImage(this.Input); this.OutPut.Name = "Image(" + this.Input.Name + ")"; return FeedBackMessage; }
private void exctractSliceToolStripMenuItem_Click(object sender, EventArgs e) { int CurrentZ = (int)this.numericUpDownZPos.Value; cDisplaySingleImage NewView = new cDisplaySingleImage(); cImage NewImage = new cImage(this.Sender.AssociatedImage.Width, this.Sender.AssociatedImage.Height, 1, this.Sender.AssociatedImage.GetNumChannels()); NewImage.Name = this.Sender.AssociatedImage.Name + " [Z=" + CurrentZ + "]"; NewImage.Resolution = new _3D.cPoint3D(this.Sender.AssociatedImage.Resolution); for (int i = 0; i < this.Sender.AssociatedImage.GetNumChannels(); i++) { Array.Copy(this.Sender.AssociatedImage.SingleChannelImage[i].Data, CurrentZ * this.Sender.AssociatedImage.SliceSize, NewImage.SingleChannelImage[i].Data, 0, NewImage.ImageSize); } NewView.SetInputData(NewImage); NewView.Run(); }
/// <summary> /// Add a new image to the montage /// </summary> /// <param name="NewIm">New image to be integrated</param> /// <param name="IsForceInconsistencies">if set to TRUE then we'll try to force the image integration within the montage even if there are some inconsistencies with the last image (resolution, number of channels)</param> public bool Add(cImage NewIm, bool IsForceInconsistencies) { if (ListImage == null) { ListImage = new List<cImage>(); ListImage.Add(NewIm); } if ((ListImage[ListImage.Count - 1].GetNumChannels() != NewIm.GetNumChannels()) && (!IsForceInconsistencies)) { return false; } else { if (this.NumberOfChannels < NewIm.GetNumChannels()) this.NumberOfChannels = NewIm.GetNumChannels(); this.ListImage.Add(NewIm); } if (((ListImage[ListImage.Count - 1].Resolution.X != NewIm.Resolution.X) && (!IsForceInconsistencies)) || ((ListImage[ListImage.Count - 1].Resolution.Y != NewIm.Resolution.Y) && (!IsForceInconsistencies)) || ((ListImage[ListImage.Count - 1].Resolution.Z != NewIm.Resolution.Z) && (!IsForceInconsistencies))) { return false; } else { this.Resolution.X = NewIm.Resolution.X; this.Resolution.Y = NewIm.Resolution.Y; this.Resolution.Z = NewIm.Resolution.Z; this.ListImage.Add(NewIm); } return true; }
private void ToolStripMenuItem_SplitByChannels(object sender, EventArgs e) { for (int i = 0; i < this.AssociatedImage.GetNumChannels(); i++) { cDisplaySingleImage NewView = new cDisplaySingleImage(); cImage NewImage = new cImage(this.AssociatedImage.Width, this.AssociatedImage.Height, this.AssociatedImage.Depth, 1); NewImage.Name = this.AssociatedImage.Name + " [" + this.AssociatedImage.SingleChannelImage[i].Name + "]"; NewImage.Resolution = new cPoint3D(this.AssociatedImage.Resolution); Array.Copy(this.AssociatedImage.SingleChannelImage[i].Data, NewImage.SingleChannelImage[0].Data, NewImage.ImageSize); NewView.SetInputData(NewImage); NewView.Run(); } }
private void ToolStripMenuItem_BitmapToImage(object sender, EventArgs e) { cDisplaySingleImage NewView = new cDisplaySingleImage(); Bitmap BMP = this.GetBitmap(); if (BMP == null) return; cImage NewImage = new cImage(BMP.Width, BMP.Height, 1, 3); NewImage.Name = "RGB_Bitmap(" + this.AssociatedImage.Name + ")"; NewImage.Resolution = new cPoint3D(this.AssociatedImage.Resolution); for (int j = 0; j < BMP.Height; j++) { for (int i = 0; i < BMP.Width; i++) { Color C = BMP.GetPixel(i, j); NewImage.SingleChannelImage[0].Data[i + j * NewImage.Width] = C.R; NewImage.SingleChannelImage[1].Data[i + j * NewImage.Width] = C.G; NewImage.SingleChannelImage[2].Data[i + j * NewImage.Width] = C.B; } } NewView.SetInputData(NewImage); NewView.Run(); }
/// <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) { }
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; }
cImage Rescale(cImage input, int inputChannel, cImage output, int outputChannel, float minBound, float maxBound) { float min = input.SingleChannelImage[inputChannel].Data.Min(); float max = input.SingleChannelImage[inputChannel].Data.Max(); if (min == max) { for (int i = 0; i < input.Height*input.Width; i++) output.SingleChannelImage[outputChannel].Data[i] = minBound; } else for (int i = 0; i < input.Width*input.Height; i++) output.SingleChannelImage[outputChannel].Data[i] = ((maxBound - minBound) * (input.SingleChannelImage[inputChannel].Data[i] - min) / (max - min)) + minBound; return output; }
private void TSItemSubPopSelectionDataTableImages(object sender, EventArgs e) { ToolStripMenuItem ParentTag = (ToolStripMenuItem)(sender); List<int> MyList = ((List<int>)(ParentTag.Tag)); cExtendedTable ET = new cExtendedTable(this.InputSimpleData.Count, MyList.Count, 0); for (int i = 0; i < this.InputSimpleData.Count; i++) { ET[i].Name = this.InputSimpleData[i].Name; } ET.ListRowNames = new List<string>(); for (int i = 0; i < MyList.Count; i++) { ET.ListRowNames.Add(i.ToString()); } if (this.InputSimpleData.ListTags != null) ET.ListTags = new List<object>(); int IdxPt = 0; FormForProgress FP = new FormForProgress(); FP.Show(); int MaxProgress = MyList.Count; FP.progressBar.Maximum = MaxProgress; foreach (var item in MyList) { for (int i = 0; i < this.InputSimpleData.Count; i++) { ET[i][IdxPt] = this.InputSimpleData[i][MyList[IdxPt]]; } if ((this.InputSimpleData.ListTags != null) && (this.InputSimpleData.ListTags[IdxPt] != null)) { if (this.InputSimpleData.ListTags[MyList[IdxPt]].GetType() == typeof(cSingleBiologicalObject)) { cSingleBiologicalObject TmpBioObj = ((cSingleBiologicalObject)this.InputSimpleData.ListTags[MyList[IdxPt]]); List<cImageMetaInfo> ListMeta = cGlobalInfo.ImageAccessor.GetImageInfo(TmpBioObj); if (ListMeta==null) continue; cImage Image = new cImage(ListMeta); TmpBioObj.BD_BoxMax.Z = TmpBioObj.BD_BoxMin.Z = 0; cImage CroppedImaged = Image.Crop(TmpBioObj.BD_BoxMin, TmpBioObj.BD_BoxMax); if((cGlobalInfo.TmpImageDisplayProperties==null)||(cGlobalInfo.TmpImageDisplayProperties.ListMin.Count != CroppedImaged.GetNumChannels())) { ET.ListTags.Add(CroppedImaged.GetBitmap(1f, null, null)); } else { cImageDisplayProperties IP = cGlobalInfo.TmpImageDisplayProperties; ET.ListTags.Add(CroppedImaged.GetBitmap(1f, IP, null)); } FP.richTextBoxForComment.AppendText("Object "+ IdxPt +" / "+MyList.Count +"\n"); } } FP.progressBar.Value = IdxPt; FP.Refresh(); IdxPt++; } FP.Close(); ET.Name = "Data Table - " + MyList.Count + " Objects"; cDisplayExtendedTable DET = new cDisplayExtendedTable(); DET.SetInputData(ET); DET.Run(); //DataPoint DP = new DataPoint(); //if (this.InputSimpleData[0].ListTags != null) //{ // if (j >= this.InputSimpleData[0].ListTags.Count) continue; // DP.Tag = this.InputSimpleData[0].ListTags[j]; // // if (DP.Tag.GetType() == typeof(cWell)) // // { // // DP.Color = ((cWell)(DP.Tag)).GetClassColor(); // // DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0]; // // } // if (DP.Tag.GetType() == typeof(cSingleBiologicalObject)) // { // // DP.Color = ((cSingleBiologicalObject)(DP.Tag)).GetColor(); // // DP.ToolTip = ((cSingleBiologicalObject)(DP.Tag)).GetAssociatedPhenotype().Name + "\nValue: (" + DP.XValue.ToString("N2") + ":" + DP.YValues[0].ToString("N2") + ")"; // } //} }
public cFeedBackMessage Run() { base.Start(); object _firstValue = base.ListProperties.FindByName("Width"); int Width = 0; if (_firstValue == null) { base.GenerateError("-Width- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; Width = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Width- Size cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Height"); int Height = 0; if (_firstValue == null) { base.GenerateError("-Height- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; Height = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Height- Size cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Depth"); int Depth = 0; if (_firstValue == null) { base.GenerateError("-Depth- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; Depth = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Depth- Size cast didn't work"); return base.FeedBackMessage; } cImage NewImage = new cImage(Width, Height, Depth, 1); NewImage.Name = "Image [" + Width + ", " + Height + ", " + Depth + "]"; cDisplaySingleImage DSI = new cDisplaySingleImage(); DSI.SetInputData(NewImage); DSI.Run(); base.End(); return FeedBackMessage; }
public cFeedBackMessage Run(c3DNewWorld _3DWorld) { if (base.Start() == false) { base.FeedBackMessage.IsSucceed = false; return base.FeedBackMessage; } #region Properties Management object _firstValue = base.ListProperties.FindByName("Thresold"); double Thresold = 0.5; if (_firstValue == null) { base.GenerateError("-Thresold- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; Thresold = (double)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Thresold- cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Split objects ?"); bool IsSplit = false; if (_firstValue == null) { base.GenerateError("-Split objects ?- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; IsSplit = (bool)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Split objects ?- cast didn't work"); return base.FeedBackMessage; } #endregion ListObjects = new cListGeometric3DObject(""); if (IsSplit == false) { c3DMeshObject MyMesh = null; if (this.VTKInput == null) { MyMesh = new c3DMeshObject(this.Input, Thresold); } else { MyMesh = new c3DMeshObject(this.VTKInput, (int)Thresold); } MyMesh.Create(Color.Aqua, this.Pos ); ListObjects.Name = MyMesh.GetName() + " metaobject"; ListObjects.Add(MyMesh); } else { // ok that's a little bit more complicated now // first we need to binarize the image cImageSegmentationThreshold IST = new cImageSegmentationThreshold(); IST.ListProperties.FindByName("Threshold").SetNewValue(Thresold); cImage SourceImage = new cImage(this.Input, false); IST.SetInputData(SourceImage); IST.Run(); // now perform image labeling cImage BinImage = IST.GetOutPut(); cImage LabeledImage = new cImage(BinImage, false); ConnectedComponentSet CCS = new ConnectedComponentSet(BinImage,LabeledImage,SourceImage, 0, eConnectivity.THREED_6, 0, float.MaxValue); Random RD = new Random(); int IdxObj = 1; // loop over each object int NumObj = CCS.Count; ListObjects.Name = "T_" + Thresold + " [" + SourceImage.Name + " Metaobject"; for(int i = 0;i<NumObj;i++) { ConnectedVoxels item = CCS[i]; // if (item.Volume <= 1) continue; List<cPoint3D> ExtremePts = item.GetExtremaPoints(); // crop the labeled image cImage TmpIm = LabeledImage.Crop(ExtremePts[0], ExtremePts[1]); // we have to clean the cropped image to prevent any overlapping object to be segmented for (int Pix = 0; Pix < TmpIm.ImageSize; Pix++) { if ((TmpIm.SingleChannelImage[0].Data[Pix] > 0) && (TmpIm.SingleChannelImage[0].Data[Pix] != IdxObj)) TmpIm.SingleChannelImage[0].Data[Pix] = 0; } // update the position of the object cPoint3D NewPos = ExtremePts[0]*SourceImage.Resolution; c3DMeshObject MyMesh = new c3DMeshObject(TmpIm.SingleChannelImage[0], 0.5); MyMesh.Create(Color.FromArgb(RD.Next(255), RD.Next(255), RD.Next(255)), NewPos); MyMesh.SetName(MyMesh.GetName() + "_" + IdxObj); MyMesh.AssociatedConnectedComponent = item; ListObjects.AddObject(MyMesh); IdxObj++; } } return base.FeedBackMessage; }
//private void CommonInit(Sequence BinarySubImageSeq) //{ // vtkImageData ImageData1 = new vtkImageData(); // ImageData1.SetDimensions(BinarySubImageSeq.Width, BinarySubImageSeq.Height, BinarySubImageSeq.Depth); // ImageData1.SetNumberOfScalarComponents(1); // ImageData1.SetSpacing(BinarySubImageSeq.XResolution, BinarySubImageSeq.YResolution, BinarySubImageSeq.ZResolution); // ImageData1.SetScalarTypeToFloat(); // vtkFloatArray array1 = new vtkFloatArray(); // for (int i = 0; i < BinarySubImageSeq.ImageSize; i++) // array1.InsertTuple1(i, BinarySubImageSeq[0].Data[0][i]); // ImageData1.GetPointData().SetScalars(array1); // vtkExtractVOI VOI = new vtkExtractVOI(); // VOI.SetInput(ImageData1); // VOI.SetSampleRate(1, 1, 1); // vtkMarchingCubes ContourObject = vtkMarchingCubes.New(); // vtk_PolyDataMapper = vtkPolyDataMapper.New(); // //ContourActor = new vtkActor(); // VOI.SetVOI(0, BinarySubImageSeq.Width - 1, 0, BinarySubImageSeq.Height - 1, 0, BinarySubImageSeq.Depth - 1); // ContourObject.SetInput(VOI.GetOutput()); // ContourObject.SetValue(0, 0.5); // vtk_PolyDataMapper.SetInput(ContourObject.GetOutput()); // vtk_PolyDataMapper.ScalarVisibilityOn(); // vtk_PolyDataMapper.SetScalarModeToUseFieldData(); //} ///// <summary> ///// Generate a 3D mesh using marching-cubes algorithm. If voxel value is lower than 1 it is consider as background, else as object ///// </summary> ///// <param name="BinarySubImageSeq">The binary image</param> ///// <param name="Colour">Mesh color</param> ///// <param name="Pos">Postion of the object in the world</param> //public void Generate(Sequence BinarySubImageSeq, Color Colour, cPoint3D Pos) //{ // vtkImageData ImageData1 = new vtkImageData(); // ImageData1.SetDimensions(BinarySubImageSeq.Width, BinarySubImageSeq.Height, BinarySubImageSeq.Depth); // ImageData1.SetNumberOfScalarComponents(1); // ImageData1.SetSpacing(BinarySubImageSeq.XResolution, BinarySubImageSeq.YResolution, BinarySubImageSeq.ZResolution); // ImageData1.SetScalarTypeToFloat(); // vtkFloatArray array1 = new vtkFloatArray(); // for (int i = 0; i < BinarySubImageSeq.ImageSize; i++) // array1.InsertTuple1(i, BinarySubImageSeq[0].Data[0][i]); // ImageData1.GetPointData().SetScalars(array1); // vtkExtractVOI VOI = new vtkExtractVOI(); // VOI.SetInput(ImageData1); // VOI.SetSampleRate(1, 1, 1); // vtkMarchingCubes ContourObject = vtkMarchingCubes.New(); // vtk_PolyDataMapper = vtkPolyDataMapper.New(); // //ContourActor = new vtkActor(); // VOI.SetVOI(0, BinarySubImageSeq.Width - 1, 0, BinarySubImageSeq.Height - 1, 0, BinarySubImageSeq.Depth - 1); // // perform the amrching cubes // ContourObject.SetInput(VOI.GetOutput()); // ContourObject.SetValue(0, 0.5); // //vtkDecimatePro deci // //deci SetInputConnection [fran GetOutputPort] // //deci SetTargetReduction 0.9 // //deci PreserveTopologyOn // if (MeshSmoother!=null) // { // vtkSmoothPolyDataFilter smoother = new vtkSmoothPolyDataFilter(); // smoother.SetInputConnection(ContourObject.GetOutputPort());// [deci GetOutputPort] // smoother.SetNumberOfIterations(50); // vtk_PolyData = smoother.GetOutput(); // } // else // { // vtk_PolyData = ContourObject.GetOutput(); // } // vtk_PolyDataMapper.SetInput(vtk_PolyData); // vtk_PolyDataMapper.ScalarVisibilityOn(); // vtk_PolyDataMapper.SetScalarModeToUseFieldData(); // this.Position = new cPoint3D(Pos.X, Pos.Y, Pos.Z); // this.Colour = Colour; // CreateVTK3DObject(1); // vtk_PolyData = ContourObject.GetOutput(); // // compute convex hull // hullFilter = vtkHull.New(); // hullFilter.SetInputConnection(ContourObject.GetOutputPort()); // hullFilter.AddRecursiveSpherePlanes(1); // hullFilter.Update(); // // this.BackfaceCulling(false); // Information = new cInformation(ContourObject, this, hullFilter); //} public void Generate(cImage BinarySubImageSeq, Color Colour, cPoint3D Pos/*, List<cBiological3DObject> Containers, int ContainerMode*/) { vtkImageData ImageData1 = new vtkImageData(); ImageData1.SetDimensions(BinarySubImageSeq.Width, BinarySubImageSeq.Height, BinarySubImageSeq.Depth); ImageData1.SetNumberOfScalarComponents(1); ImageData1.SetSpacing(BinarySubImageSeq.Resolution.X, BinarySubImageSeq.Resolution.Y, BinarySubImageSeq.Resolution.Z); ImageData1.SetScalarTypeToFloat(); vtkFloatArray array1 = new vtkFloatArray(); for (int i = 0; i < BinarySubImageSeq.ImageSize; i++) array1.InsertTuple1(i, BinarySubImageSeq.SingleChannelImage[0].Data[i]); ImageData1.GetPointData().SetScalars(array1); vtkExtractVOI VOI = new vtkExtractVOI(); VOI.SetInput(ImageData1); VOI.SetSampleRate(1, 1, 1); vtkMarchingCubes ContourObject = vtkMarchingCubes.New(); vtk_PolyDataMapper = vtkPolyDataMapper.New(); //ContourActor = new vtkActor(); VOI.SetVOI(0, BinarySubImageSeq.Width - 1, 0, BinarySubImageSeq.Height - 1, 0, BinarySubImageSeq.Depth - 1); ContourObject.SetInput(VOI.GetOutput()); ContourObject.SetValue(0, 0.5); vtkAlgorithmOutput AlgoOutPut = null; if (MeshSmoother != null) { //vtkSmoothPolyDataFilter smoother = new vtkSmoothPolyDataFilter(); vtkWindowedSincPolyDataFilter smoother = new vtkWindowedSincPolyDataFilter(); smoother.SetInputConnection(ContourObject.GetOutputPort());// [deci GetOutputPort] smoother.SetNumberOfIterations(MeshSmoother.NumberOfIterations); vtk_PolyData = smoother.GetOutput(); //smoother.GetOutputPort(); AlgoOutPut = smoother.GetOutputPort(); } else { vtk_PolyData = ContourObject.GetOutput(); AlgoOutPut = ContourObject.GetOutputPort(); } vtk_PolyDataMapper.SetInput(vtk_PolyData); vtk_PolyDataMapper.ScalarVisibilityOn(); vtk_PolyDataMapper.SetScalarModeToUseFieldData(); vtkActor TmpActor = vtkActor.New(); TmpActor.SetMapper(vtk_PolyDataMapper); TmpActor.SetPosition(Pos.X, Pos.Y, Pos.Z); //Console.WriteLine("PosX"+Pos.X+" PosY"+Pos.Y+" PosZ"+Pos.Z); #region deal with the containers if (this.Containers != null) { if (this.Containers.ContainerMode == 0) { cPoint3D Centroid = new cPoint3D((float)TmpActor.GetCenter()[0], (float)TmpActor.GetCenter()[1], (float)TmpActor.GetCenter()[2]); bool IsInside = false; for (int Idx = 0; Idx < Containers.Containers.Count; Idx++) { cBiological3DVolume CurrentContainer = (cBiological3DVolume)(Containers.Containers[Idx]); if (CurrentContainer.IsPointInside(Centroid)) { IsInside = true; ContainerIdx = Idx; break; } } if (IsInside) { this.SetPosition(new cPoint3D(Pos.X, Pos.Y, Pos.Z)); this.Colour = Colour; CreateVTK3DObject(1); // vtk_PolyData = ContourObject.GetOutput(); // compute convex hull hullFilter = vtkHull.New(); hullFilter.SetInputConnection(AlgoOutPut); hullFilter.AddRecursiveSpherePlanes(0); hullFilter.Update(); Information = new cInformation(AlgoOutPut, this, hullFilter); this.Detected = true; } else { this.Detected = false; } } else if (Containers.ContainerMode == 1) { this.Detected = true; //bool IsInside = false; for (int Idx = 0; Idx < Containers.Containers.Count; Idx++) { cBiological3DVolume CurrentContainer = (cBiological3DVolume)(Containers.Containers[Idx]); if (CurrentContainer.IsPointInside(Pos)) { //IsInside = false; this.Detected = false; return; } } this.SetPosition(new cPoint3D(Pos.X, Pos.Y, Pos.Z)); this.Colour = Colour; CreateVTK3DObject(1); // vtk_PolyData = ContourObject.GetOutput(); // compute convex hull hullFilter = vtkHull.New(); hullFilter.SetInputConnection(AlgoOutPut); hullFilter.AddRecursiveSpherePlanes(0); hullFilter.Update(); Information = new cInformation(AlgoOutPut, this, hullFilter); this.Detected = true; } } else { this.SetPosition(new cPoint3D(Pos.X, Pos.Y, Pos.Z)); this.Colour = Colour; CreateVTK3DObject(1); // vtk_PolyData = ContourObject.GetOutput(); // compute convex hull hullFilter = vtkHull.New(); hullFilter.SetInputConnection(AlgoOutPut); hullFilter.AddRecursiveSpherePlanes(1); hullFilter.Update(); // this.BackfaceCulling(false); Information = new cInformation(AlgoOutPut, this, hullFilter); } #endregion }
cFeedBackMessage Process() { if (base.Start() == false) { base.FeedBackMessage.IsSucceed = false; return base.FeedBackMessage; } object _field = base.ListProperties.FindByName("Field"); int Field = 0; if (_field == null) { base.GenerateError("-Field- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_field; Field = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Field- cast didn't work"); return base.FeedBackMessage; } //this.Output = this.Input[0].GetImage(Field); cGlobalInfo.ImageAccessor.Field = Field;// (int)this.numericUpDownField.Value; List<cImageMetaInfo> ImageMetaInfo = cGlobalInfo.ImageAccessor.GetImageInfo(this.Input[0]); if(ImageMetaInfo==null) { FeedBackMessage.IsSucceed = false; base.End(); return FeedBackMessage; } //string FileName = ImageMetaInfo[0].FileName; this.Output = new cImage(ImageMetaInfo); //this.Output = new cImage(30000, 5000, 1, 1); //for (int i = 0; i < this.Output.SliceSize; i++) //{ // this.Output.SingleChannelImage[0].Data[i] = i; //} base.End(); return FeedBackMessage; }
public void SetInputData(cImage InputImage) { base.Title += ": " + InputImage.Name; this.InputImage = InputImage; }
//public void DrawPic() //{ // if (this.LUTManager == null) return; // if (this.ZNavigator == null) return; // int ZPos = ZNavigator.trackBarForZPos.Value; // ThisGraph = this.CreateGraphics(); // float ZoomFactor = Zoom / 100.0f; // int NewWidth = (int)(AssociatedImage.Width * ZoomFactor); // int NewHeight = (int)(AssociatedImage.Height * ZoomFactor); // this.Width = NewWidth; // this.Height = NewHeight; // if ((NewHeight == 0) || (NewWidth == 0)) return; // int PosViewX = (this.Width - NewWidth) / 2; // int PosViewY = (this.Height - NewHeight) / 2; // // this.Location = new Point(PosViewX,PosViewY); // BT = new Bitmap(NewWidth, NewHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb); // // Lock the bitmap's bits. // Rectangle rect = new Rectangle(0, 0, NewWidth, NewHeight); // System.Drawing.Imaging.BitmapData bmpData = BT.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, BT.PixelFormat); // // Get the address of the first line. // IntPtr ptr = bmpData.Scan0; // int scanline = Math.Abs(bmpData.Stride); // byte CurrentRed; // byte CurrentGreen; // byte CurrentBlue; // int RealX; // int RealY; // int NewStartX = (int)(this.StartViewX / ZoomFactor); // int NewStartY = (int)(this.StartViewY / ZoomFactor); // List<float> Min = new List<float>(); // List<float> Max = new List<float>(); // List<double> GammaList = new List<double>(); // for (int IdxChannel = 0; IdxChannel < this.AssociatedImage.GetNumChannels(); IdxChannel++) // { // if (this.LUTManager != null) // { // UserControlSingleLUT SingleLUT = (UserControlSingleLUT)this.LUTManager.panelForLUTS.Controls[IdxChannel]; // Min.Add((float)SingleLUT.numericUpDownMinValue.Value); // Max.Add((float)SingleLUT.numericUpDownMaxValue.Value); // GammaList.Add((double)SingleLUT.trackBarGamma.Value / 100.0); // } // } // #region Obsolete // // test for new display // //List<byte[][]> ListLut = new List<byte[][]>(); // //for (int IdxChannel = 0; IdxChannel < this.AssociatedImage.NumChannels; IdxChannel++) // //{ // // UserControlSingleLUT SingleLUT = (UserControlSingleLUT)this.LUTManager.panelForLUTS.Controls[IdxChannel]; // // if (SingleLUT.checkBoxIsActive.Checked == false) continue; // // ListLut.Add(SingleLUT.SelectedLUT); // //} // //ConvertImageFloatToRGB(AssociatedImage, 0, 255, ListLut, 0); // #endregion // // Declare an array to hold the bytes of the bitmap. // int bytes = scanline * NewHeight; // byte[] rgbValues = new byte[bytes]; // // Copy the RGB values into the array. // System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes); // for (int IdxChannel = 0; IdxChannel < this.AssociatedImage.GetNumChannels(); IdxChannel++) // { // UserControlSingleLUT SingleLUT = (UserControlSingleLUT)this.LUTManager.panelForLUTS.Controls[IdxChannel]; // if (SingleLUT.checkBoxIsActive.Checked == false) continue; // byte[][] CurrentLUT = SingleLUT.SelectedLUT; // //ConvertImageFloatToRGB(AssociatedImage, 0, 255, SingleLUT.SelectedLUT, 0); // if (GammaList[IdxChannel] != 1) // { // for (int FullY = 0; FullY < NewHeight; FullY++) // { // RealY = (int)(FullY / ZoomFactor) + NewStartY; // if (RealY >= AssociatedImage.Height) RealY = AssociatedImage.Height - 1; // for (int FullX = 0; FullX < NewWidth; FullX++) // { // RealX = (int)(FullX / ZoomFactor) + NewStartX; // if (RealX >= AssociatedImage.Width) RealX = AssociatedImage.Width - 1; // float Value = AssociatedImage.SingleChannelImage[IdxChannel].Data[RealX + RealY * AssociatedImage.Width + ZPos * AssociatedImage.SliceSize]; // Value = (float)Math.Pow(Value, GammaList[IdxChannel]); // int ConvertedValue = (int)((((CurrentLUT[0].Length - 1) * (Value - Min[IdxChannel])) / (Max[IdxChannel] - Min[IdxChannel]))); // if (ConvertedValue < 0) ConvertedValue = 0; // if (ConvertedValue >= CurrentLUT[0].Length) ConvertedValue = CurrentLUT[0].Length - 1; // CurrentRed = (byte)CurrentLUT[0][ConvertedValue]; // CurrentGreen = (byte)CurrentLUT[1][ConvertedValue]; // CurrentBlue = (byte)CurrentLUT[2][ConvertedValue]; // double NewValue = rgbValues[3 * FullX + FullY * scanline] + CurrentBlue; // if (NewValue > 255) // rgbValues[3 * FullX + FullY * scanline] = 255; // else // rgbValues[3 * FullX + FullY * scanline] += CurrentBlue; // NewValue = rgbValues[3 * FullX + 1 + FullY * scanline] + CurrentGreen; // if (NewValue > 255) // rgbValues[3 * FullX + 1 + FullY * scanline] = 255; // else // rgbValues[3 * FullX + 1 + FullY * scanline] += CurrentGreen; // NewValue = rgbValues[3 * FullX + 2 + FullY * scanline] + CurrentRed; // if (NewValue > 255) // rgbValues[3 * FullX + 2 + FullY * scanline] = 255; // else // rgbValues[3 * FullX + 2 + FullY * scanline] += CurrentRed; // } // } // } // else // { // for (int FullY = 0; FullY < NewHeight; FullY++) // { // RealY = (int)(FullY / ZoomFactor) + NewStartY; // if (RealY >= AssociatedImage.Height) RealY = AssociatedImage.Height - 1; // for (int FullX = 0; FullX < NewWidth; FullX++) // { // RealX = (int)(FullX / ZoomFactor) + NewStartX; // if (RealX >= AssociatedImage.Width) RealX = AssociatedImage.Width - 1; // float Value = AssociatedImage.SingleChannelImage[IdxChannel].Data[RealX + RealY * AssociatedImage.Width + ZPos * AssociatedImage.SliceSize]; // int ConvertedValue = (int)((((CurrentLUT[0].Length - 1) * (Value - Min[IdxChannel])) / (Max[IdxChannel] - Min[IdxChannel]))); // if (ConvertedValue < 0) ConvertedValue = 0; // if (ConvertedValue >= CurrentLUT[0].Length) ConvertedValue = CurrentLUT[0].Length - 1; // CurrentRed = (byte)CurrentLUT[0][ConvertedValue]; // CurrentGreen = (byte)CurrentLUT[1][ConvertedValue]; // CurrentBlue = (byte)CurrentLUT[2][ConvertedValue]; // double NewValue = rgbValues[3 * FullX + FullY * scanline] + CurrentBlue; // if (NewValue > 255) // rgbValues[3 * FullX + FullY * scanline] = 255; // else // rgbValues[3 * FullX + FullY * scanline] += CurrentBlue; // NewValue = rgbValues[3 * FullX + 1 + FullY * scanline] + CurrentGreen; // if (NewValue > 255) // rgbValues[3 * FullX + 1 + FullY * scanline] = 255; // else // rgbValues[3 * FullX + 1 + FullY * scanline] += CurrentGreen; // NewValue = rgbValues[3 * FullX + 2 + FullY * scanline] + CurrentRed; // if (NewValue > 255) // rgbValues[3 * FullX + 2 + FullY * scanline] = 255; // else // rgbValues[3 * FullX + 2 + FullY * scanline] += CurrentRed; // } // } // } // } // // Copy the RGB values back to the bitmap // System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes); // // Unlock the bits. // BT.UnlockBits(bmpData); // // Draw the modified image. // ThisGraph.DrawImage(BT, this.StartViewX, this.StartViewY); // DrawLayers(ZoomFactor); //} public Bitmap ConvertImageFloatToRGB(cImage ImageFloat, float Min, float Max, List<byte[][]> ListSelectedLUTs, int Z) { Bitmap BMP = new Bitmap(ImageFloat.Width, ImageFloat.Height, PixelFormat.Format24bppRgb); BitmapData bData = BMP.LockBits(new Rectangle(0, 0, ImageFloat.Width, ImageFloat.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb); /*the size of the image in bytes */ int size = bData.Stride * bData.Height; /*Allocate buffer for image*/ byte[] ConvertedValues = new byte[size]; int Zpos = Z * ImageFloat.Width * ImageFloat.Height; int Ypos; float MAXMIN = Max - Min; double NewValue; byte CurrentRed; byte CurrentGreen; byte CurrentBlue; for (int Channel = 0; Channel < ImageFloat.GetNumChannels(); Channel++) { byte[][] SelectedLUT = ListSelectedLUTs[Channel]; int LUTLength = SelectedLUT[0].Length - 1; for (int j = 0; j < ImageFloat.Height; j++) { Ypos = j * AssociatedImage.Width; for (int i = 0; i < ImageFloat.Width; i++) { float Value = ImageFloat.SingleChannelImage[Channel].Data[i + Ypos + Zpos]; int ConvertedValue = (int)((LUTLength * (Value - Min)) / MAXMIN); if (ConvertedValue < 0) ConvertedValue = 0; else if (ConvertedValue > LUTLength) ConvertedValue = LUTLength; CurrentRed = (byte)SelectedLUT[0][ConvertedValue]; CurrentGreen = (byte)SelectedLUT[1][ConvertedValue]; CurrentBlue = (byte)SelectedLUT[2][ConvertedValue]; NewValue = ConvertedValues[i * 3 + j * bData.Stride] + CurrentBlue; if (NewValue > 255) ConvertedValues[i * 3 + j * bData.Stride] = 255; else ConvertedValues[i * 3 + j * bData.Stride] += CurrentBlue; NewValue = ConvertedValues[i * 3 + j * bData.Stride + 1] + CurrentGreen; if (NewValue > 255) ConvertedValues[i * 3 + j * bData.Stride + 1] = 255; else ConvertedValues[i * 3 + j * bData.Stride + 1] += CurrentGreen; NewValue = ConvertedValues[i * 3 + j * bData.Stride + 2] + CurrentRed; if (NewValue > 255) ConvertedValues[i * 3 + j * bData.Stride + 2] = 255; else ConvertedValues[i * 3 + j * bData.Stride + 2] += CurrentRed; //for (int RGBIdx = 0; RGBIdx < 3; RGBIdx++) //{ // NewValue = (ConvertedValues[i * 3 + j * bData.Stride + RGBIdx] + ConvertedValue); // if (NewValue >= LUTLength) NewValue = LUTLength - 1; // // now go through the LUT // //ConvertedValues[i * 3 + j * bData.Stride + 0] = SelectedLUT[2][NewValue]; // //ConvertedValues[i * 3 + j * bData.Stride + 1] = SelectedLUT[1][NewValue]; // ConvertedValues[i * 3 + j * bData.Stride + RGBIdx] = SelectedLUT[RGBIdx][NewValue]; //} //ConvertedValues[i * 3 + j * bData.Stride + Channel] = (byte)NewValue; } } } //for (int j = 0; j < ImageFloat.Height; j++) //{ // Ypos = j * AssociatedImage.Width; // for (int i = 0; i < ImageFloat.Width; i++) // { // BMP.SetPixel(i, j, Color.FromArgb(SelectedLUT[0][ConvertedValues[i+Ypos]], // SelectedLUT[1][ConvertedValues[i + Ypos]], // SelectedLUT[2][ConvertedValues[i + Ypos]])); // } //} /*This overload copies data of /size/ into /data/ from location specified (/Scan0/)*/ //System.Runtime.InteropServices.Marshal.Copy(bData.Scan0, ConvertedValues, 0, size); //for (int i = 0; i < size; i += bitsPerPixel / 8) //{ // double magnitude = 1 / 3d * (ConvertedValues[i] + ConvertedValues[i + 1] + ConvertedValues[i + 2]); // //data[i] is the first of 3 bytes of color //} /* This override copies the data back into the location specified */ System.Runtime.InteropServices.Marshal.Copy(ConvertedValues, 0, bData.Scan0, ConvertedValues.Length); BMP.UnlockBits(bData); Form1 F = new Form1(); F.pictureBox1.Image = BMP; F.ShowDialog(); return BMP; }
public void SetInputData(cImage input, int inputBand) { this.Input = input; this.ListChannelsToBeProcessed.Add(inputBand); }
public void CurrentPanel_DragDrop(object sender, DragEventArgs e) { cImage SourceImage = (cImage)e.Data.GetData(typeof(cImage)); cDisplaySingleImage NewView = new cDisplaySingleImage(); cImage NewIm = new cImage(SourceImage.Width, SourceImage.Height, SourceImage.Depth, SourceImage.GetNumChannels() + this.AssociatedImage.GetNumChannels()); int IdxChannel = 0; for (int i = 0; i < SourceImage.GetNumChannels(); i++) Array.Copy(SourceImage.SingleChannelImage[i].Data, NewIm.SingleChannelImage[IdxChannel++].Data, NewIm.SliceSize); for (int i = 0; i < this.AssociatedImage.GetNumChannels(); i++) Array.Copy(this.AssociatedImage.SingleChannelImage[i].Data, NewIm.SingleChannelImage[IdxChannel++].Data, NewIm.SliceSize); NewView.SetInputData(NewIm); NewView.Run(); cGlobalInfo.WindowHCSAnalyzer.richTextBoxConsole.AppendText("DragNDrop: from " + SourceImage.Name + " to " + this.AssociatedImage.Name + "\n"); }
public void SetInputData(cImage input) { this.Input = input; this.ListChannelsToBeProcessed.AddRange(input.GetListChannels()); }
private void ToolStripMenuItem_DisplayImage(object sender, EventArgs e) { List<cImageMetaInfo> ListInfo = cGlobalInfo.ImageAccessor.GetImageInfo(this); cImage Image = new cImage(ListInfo); this.BD_BoxMax.Z = this.BD_BoxMin.Z = 0; // this.BD_BoxMin.Y = Image.Height - this.BD_BoxMin.Y; // this.BD_BoxMax.Y = Image.Height - this.BD_BoxMax.Y; if (this.BD_BoxMin.Y > this.BD_BoxMax.Y) { double Tmp = this.BD_BoxMin.Y; this.BD_BoxMin.Y = this.BD_BoxMax.Y; this.BD_BoxMax.Y = Tmp; } cImage CroppedImaged = Image.Crop(this.BD_BoxMin, this.BD_BoxMax); cDisplaySingleImage IV = new cDisplaySingleImage(); IV.IsUseSavedDefaultDisplayProperties = true; IV.DefaultZoom = 100; IV.Title = "[Plate] " + this.AssociatedWell.AssociatedPlate.GetName() + " - [Well] " + this.AssociatedWell.GetPos() + " - [Field] " + this.ImageField + " - " + this.CellularPhenotypeType.Name; IV.SetInputData(CroppedImaged); IV.Run(); }
// Image ImageToDisp = new Bitmap(@"C:\Workspace\IM3\IM3 Plugin3\bin\Background.png"); ///// <summary> ///// Optional method to override. Init() is called before the loop of Process() call ///// </summary> //public override void Init() //{ //} /// <summary> /// Process() is called in a loop when the user start a process. /// </summary> /// <param name="experiment"></param> //public override void Process(Experiment experiment) //{ // // Use Experiment as you wish! // //Experiment e = experiment; // for (int i = 0; i < experiment.Sequences;i++) // { // Sequence SeqToProcess = experiment.SequenceList[i]; // AnalyseSequence(experiment, SeqToProcess); // } //} ///// <summary> ///// Optional method to override. Conclude() is called after the loop of Process() call ///// </summary> //public override void Conclude() //{ //} public Plugin3D(cImage AssociatedImage) { InitializeComponent(); this.AssociatedImage = AssociatedImage; Show(); }
public void Run() { // first we have to convert the image with the right number of color cImage RescaledInput = new cImage(Input.Width, Input.Height, Input.Depth, 1); int[] Histo = new int[HistoSize]; // Rescale(Input, inputBand, RescaledInput, 0, 0, HistoSize - 1); float[] inp = RescaledInput.SingleChannelImage[0].Data; float[] outp = Output.SingleChannelImage[outputBand].Data; int PosX, PosY; for (int depth = 0; depth < Input.Depth; depth++) { int i, j, ki, kj; int Value = 0; int IdxFinal = 0; int Threshold = ((2 * Radius + 1) * (2 * Radius + 1)) / 2; #region main loop for (j = 0; j < Input.Height; j++) { for (int Idx = 0; Idx < HistoSize; Idx++) Histo[Idx] = 0; for (kj = -Radius; kj <= Radius; kj++) for (ki = -Radius; ki <= Radius; ki++) { PosX = ki; if (PosX < 0) PosX = -PosX - 1; else if (PosX >= Input.Width) PosX = 2 * Input.Width - PosX - 1; PosY = kj + j; if (PosY < 0) PosY = -PosY - 1; else if (PosY >= Input.Height) PosY = 2 * Input.Height - PosY - 1; Histo[(int)inp[PosX + PosY * Input.Width + depth * Input.SliceSize]]++; } Value = 0; IdxFinal = 0; while (Value < Threshold) { Value += Histo[IdxFinal]; IdxFinal++; } outp[Radius + 1 + j * Input.Width + depth * Input.SliceSize] = IdxFinal; //for (i = 0; i < input.Width; i++) for (i = 0; i < Input.Width/* - (radius + 1)*/; i++) { // remove the first column for (int Idx = -Radius; Idx <= Radius; Idx++) { PosX = i - Radius - 1; if (PosX < 0) PosX = -PosX - 1; else if (PosX >= Input.Width) PosX = 2 * Input.Width - PosX - 1; PosY = j + Idx; if (PosY < 0) PosY = -PosY - 1; else if (PosY >= Input.Height) PosY = 2 * Input.Height - PosY - 1; Histo[(int)inp[PosX + PosY * Input.Width + depth * Input.SliceSize]]--; } // add the new column for (int Idx = -Radius; Idx <= Radius; Idx++) { PosX = i + Radius; if (PosX < 0) PosX = -PosX - 1; if (PosX >= Input.Width) PosX = Input.Width - (PosX - Input.Width + 1); PosY = j + Idx; if (PosY < 0) PosY = -PosY - 1; if (PosY >= Input.Height) PosY = 2 * Input.Height - PosY - 1; Histo[(int)inp[PosX + PosY * Input.Width + depth * Input.SliceSize]]++; } Value = 0; IdxFinal = 0; while (Value < Threshold) { Value += Histo[IdxFinal]; IdxFinal++; } //return; outp[i + j * Input.Width + depth * Input.SliceSize] = IdxFinal; } } #endregion } return; }
public cFeedBackMessage Run() { if (base.Start() == false) { base.FeedBackMessage.IsSucceed = false; return base.FeedBackMessage; } #region parameters initilization object _firstValue = base.ListProperties.FindByName("Kernel size"); int KernelSize = 0; if (_firstValue == null) { base.GenerateError("Kernel size not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; KernelSize = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("Kernel size cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Image width"); int ImWidth = 0; if (_firstValue == null) { base.GenerateError("Image width not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; ImWidth = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("Image width cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Image height"); int ImHeight = 0; if (_firstValue == null) { base.GenerateError("Image height not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; ImHeight = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("Image height cast didn't work"); return base.FeedBackMessage; } _firstValue = base.ListProperties.FindByName("Image depth"); int ImDepth = 0; if (_firstValue == null) { base.GenerateError("Image depth not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; ImDepth = (int)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("Image depth cast didn't work"); return base.FeedBackMessage; } #endregion if (this.Input[0].Count == 2) ImDepth = 1; if (this.Input[0].Count == 1) { ImDepth = 1; ImHeight = 1; } this.Output = new cImage(ImWidth, ImHeight, ImDepth, this.Input.Count); cImageDrawKernel GK = new cImageDrawKernel(); GK.sigma_x = KernelSize; GK.sigma_y = KernelSize; GK.sigma_z = KernelSize; GK.Run(); cImage K = GK.GetOutPut(); for (int IdxChannel = 0; IdxChannel < this.Input.Count; IdxChannel++) { cExtendedTable CurrentTable = this.Input[IdxChannel]; cExtendedList ListVolumes = new cExtendedList(); double MaxX = CurrentTable[0].Max(); double MinX = CurrentTable[0].Min(); double MaxY = CurrentTable[1].Max(); double MinY = CurrentTable[1].Min(); double MaxZ = 0; double MinZ = 0; if (CurrentTable.Count>2) { MaxZ = CurrentTable[2].Max(); MinZ = CurrentTable[2].Min(); } this.Output.SingleChannelImage[IdxChannel].Resolution.X = (MaxX - MinX) / (double)ImWidth; this.Output.SingleChannelImage[IdxChannel].Resolution.Y = (MaxY - MinY) / (double)ImHeight; this.Output.SingleChannelImage[IdxChannel].Resolution.Z = (MaxZ - MinZ) / (double)ImDepth; if (CurrentTable.Count > 2) { for (int j = 0; j < CurrentTable[0].Count; j++) { double TmpValueX = (ImWidth * (CurrentTable[0][j] - MinX)) / (MaxX - MinX) - K.Width / 2; double TmpValueY = (ImHeight * (CurrentTable[1][j] - MinY)) / (MaxY - MinY) - K.Height / 2; double TmpValueZ = (ImDepth * (CurrentTable[2][j] - MinZ)) / (MaxZ - MinZ) - K.Depth / 2; this.Output.AddInto(K, (int)TmpValueX, (int)TmpValueY, (int)TmpValueZ, IdxChannel); } } else { for (int j = 0; j < CurrentTable[0].Count; j++) { double TmpValueX = (ImWidth * (CurrentTable[0][j] - MinX)) / (MaxX - MinX) - K.Width / 2; double TmpValueY = ImHeight - (ImHeight * (CurrentTable[1][j] - MinY)) / (MaxY - MinY) - K.Height / 2; this.Output.AddInto(K, (int)TmpValueX, (int)TmpValueY, 0, IdxChannel); } } cListExtendedTable TablesForDensity = new cListExtendedTable(this.Output); for (int idxChannel = 0; idxChannel < this.Output.GetNumChannels(); idxChannel++) { this.Output.SingleChannelImage[idxChannel].Name = this.Input.Name;//cGlobalInfo.ListCellularPhenotypes[idxChannel].Name; float Sum = 1; if (IsNormalized) { Sum = (float)TablesForDensity[idxChannel].Sum(); if (Sum <= 0.0) continue; for (int i = 0; i < this.Output.SingleChannelImage[idxChannel].Data.Length; i++) { this.Output.SingleChannelImage[idxChannel].Data[i] = (10000000 * this.Output.SingleChannelImage[idxChannel].Data[i]) / Sum; } } //else //{ // for (int i = 0; i < this.Output.SingleChannelImage[idxChannel].Data.Length; i++) // { // // if (ClassPopulations[idxChannel] > 0) // this.Output.SingleChannelImage[idxChannel].Data[i] = this.Output.SingleChannelImage[idxChannel].Data[i]; // } //} } } this.Output.SingleChannelImage[0].UpDateMax(); this.Output.SingleChannelImage[0].UpDateMin(); base.End(); return FeedBackMessage; }
public void SetInputData(cImage input, List<int> ListChannelsToBeProcessed) { this.Input = input; this.ListChannelsToBeProcessed.AddRange(ListChannelsToBeProcessed); }
internal ConnectedVoxels(int label, cImage labeledImage, cImage image, eConnectivity connectivity) : base(label, labeledImage, image, connectivity) { }
private void AnalyseSequence(cImage SeqToAnalyse) { // //FormForThumbnails WindThumbnail = new FormForThumbnails(); // //for (int k = 0; k < ListFormForControl.Count; k++) // //{ // // FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k-1); // // Obj.DisplayThumbnail(WindThumbnail); // //} // //WindThumbnail.Show(); // //return; #region initialization if (SeqToAnalyse == null) return; // create World if (Current3DWorld == null) { Current3DWorld = new c3DNewWorld(new cPoint3D(SeqToAnalyse.Width, SeqToAnalyse.Height, SeqToAnalyse.Depth), new cPoint3D(SeqToAnalyse.Resolution)); } else { // // Current3DWorld.ren1. // Current3DWorld.Terminate(); Current3DWorld = null; Current3DWorld = new c3DNewWorld(new cPoint3D(SeqToAnalyse.Width, SeqToAnalyse.Height, SeqToAnalyse.Depth), new cPoint3D(SeqToAnalyse.Resolution)); } for (int k = 0; k < ListFormForControl.Count; k++) { FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k-1); if (Obj.numericUpDownChannel.Value >= SeqToAnalyse.GetNumChannels()) { MessageBox.Show("Wrong number of channels", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } // // Current3DWorld.ListObjControl = ListFormForControl; // // dataGridViewForClassif.DataSource = CurrentTable; // if (DataGrid == null) // { // DataGrid = new FormForDataGridView(); // DataGrid.Show(); // } // Current3DWorld.SetLinkToDataGridView(DataGrid.dataGridViewForResults); Current3DWorld.ListMetaObjectList = new List<cMetaBiologicalObjectList>(); cMetaBiologicalObjectList ListMetacells = new cMetaBiologicalObjectList("List Meta Objects"); Current3DWorld.ListMetaObjectList.Add(ListMetacells); #endregion #region Detection for (int k = 0; k < ListFormForControl.Count; k++) { FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k -1); if (Obj.radioButtonIsVolume.Checked) // we have to detect a volume ! { cVolumeDetection Detection = new cVolumeDetection(SeqToAnalyse, (int)Obj.numericUpDownChannel.Value, Obj.WindowForVolumeDetection.checkBoxIsBorderKill.Checked); Detection.SetShift(new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value)); if ((Obj.checkBoxPreProcessings.Checked == false) || (Obj.WindowForPreProcessing.checkBoxMedianIsDisabled.Checked)) { Detection.SetMedian(-1); Detection.SetShift(new cPoint3D(0, 0, 0)); } else { Detection.SetMedian((int)Obj.WindowForPreProcessing.numericUpDownMedianKernel.Value); Detection.SetShift(new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value)); } if (Obj.WindowForVolumeDetection.checkBoxVolumeSmooth.Checked) Detection.MeshSmoother = new cMeshSmoother((int)Obj.WindowForVolumeDetection.numericUpDownSmoothIterations.Value); if ((Obj.comboBoxContainer.SelectedItem !=null) && (Obj.comboBoxContainer.SelectedItem.ToString() != "")) { Detection.SetContainers(Current3DWorld.GetListBiologicalObjectsOfType(Obj.comboBoxContainer.Items[0].ToString())); if (Obj.InOrOut.radioButtonIn.Checked) Detection.SetContainersMode(0); else Detection.SetContainersMode(1); } else Detection.SetContainers(null); if (Obj.WindowForVolumeDetection.checkBoxIsRegionGrowing.Checked == false) // no region growing direct detection { Obj.AssociatedBiologicalObjectList = Detection.IntensityThreshold((float)Obj.WindowForVolumeDetection.numericUpDownIntensityThreshold.Value, (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMinVol.Value, (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMaxVol.Value); } else // region growing { if (Obj.WindowForVolumeDetection.radioButtonRegionsBased.Checked) // start from a segmentation { if (Obj.WindowForVolumeDetection.radioButtonVolumeDetectionNew.Checked) // a new segmentation has to be performed { // // Image3D CurrentPatch = new Image3D(2 * Radius, 2 * Radius, 1, CurrentImageToProcess.NumBands); cImage CurrentBinary = new cImage(SeqToAnalyse.Width, SeqToAnalyse.Height, SeqToAnalyse.Depth, 1); for (int i = 0; i < CurrentBinary.ImageSize; i++) { if (SeqToAnalyse.SingleChannelImage[(int)Obj.numericUpDownChannel.Value].Data[i] >= (float)Obj.WindowForVolumeDetection.numericUpDownIntensityThreshold.Value) CurrentBinary.SingleChannelImage[0].Data[i] = 1; } eConnectivity CurrentConnectivity = eConnectivity.TWOD_4; if (CurrentBinary.Depth > 1) CurrentConnectivity = eConnectivity.THREED_6; ConnectedComponentSet OFNucleus = new ConnectedComponentSet(CurrentBinary, null, null, 0, CurrentConnectivity, (int)Obj.WindowForVolumeDetection.numericUpDownRegionBasedMinArea.Value, (int)Obj.WindowForVolumeDetection.numericUpDownRegionBasedMaxArea.Value); // // RegionGrowing = new cRegionGrowing(OFNucleus, NewSeq[0], (int)numericUpDownChannelForRegionGrowing.Value, (float)numericUpDownIntensityForRegionGrowing.Value, (int)numericUpDownMaxNucleusArea.Value); int NumIterations = -1; if (Obj.WindowForVolumeDetection.checkBoxIsConvergence.Checked == false) NumIterations = (int)Obj.WindowForVolumeDetection.numericUpDownIterationNumber.Value; float MergingRatio = (float)((Obj.WindowForVolumeDetection.trackBarMergingStrength.Maximum - Obj.WindowForVolumeDetection.trackBarMergingStrength.Value) / 100.0); Obj.AssociatedBiologicalObjectList = Detection.RegionGrowing(OFNucleus, (float)Obj.WindowForVolumeDetection.numericUpDownIntensityForRegionGrowing.Value, (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMinVol.Value, (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMaxVol.Value, NumIterations, MergingRatio); } // else // { // throw new System.ArgumentException("Not implemented", "Error"); // } // } // else // start from seeds points // { // // first gather the seeds // if (Obj.WindowForVolumeDetection.comboBoxExistingSpotsDetected.Items.Count == 0) break; // List<cBiological3DObject> ListSeeds = Current3DWorld.GetListBiologicalObjectsOfType(Obj.WindowForVolumeDetection.comboBoxExistingSpotsDetected.Items[0].ToString()); // int NumIterations = -1; // if (Obj.WindowForVolumeDetection.checkBoxIsConvergence.Checked == false) NumIterations = (int)Obj.WindowForVolumeDetection.numericUpDownIterationNumber.Value; // float MergingRatio = (float)((Obj.WindowForVolumeDetection.trackBarMergingStrength.Maximum - Obj.WindowForVolumeDetection.trackBarMergingStrength.Value) / 100.0); // Obj.AssociatedBiologicalObjectList = Detection.RegionGrowing(ListSeeds, // (float)Obj.WindowForVolumeDetection.numericUpDownIntensityForRegionGrowing.Value, // (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMinVol.Value, // (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMaxVol.Value, NumIterations, MergingRatio); } } if (Obj.AssociatedBiologicalObjectList != null) { Obj.richTextBoxInfo.AppendText(Obj.AssociatedBiologicalObjectList.Count + " objects detected."); for (int i = 0; i < Obj.AssociatedBiologicalObjectList.Count; i++) { cBiological3DVolume TmpVol = (cBiological3DVolume)Obj.AssociatedBiologicalObjectList[i]; Obj.AssociatedBiologicalObjectList[i].SetType(Obj.textBoxName.Text); // TmpVol.ThumbnailnewImage = imageListForThumbnail.Images[Obj.AssociatedBiologicalObjectList[i].GetType() + ".jpg"]; Obj.AssociatedBiologicalObjectList[i].Name = Obj.textBoxName.Text + " " + i; // Obj.AssociatedBiologicalObjectList[i].IsMaster = Obj.IsMasterObject(); // List<double> Res = TmpVol.Information.GetInformation(); if (Obj.checkBoxIsDisplayName.Checked) { cGeometric3DObject AssociatedText = TmpVol.AttachText(TmpVol.Name, 10, Color.White); AssociatedText.IsStayInFrontOfCamera = true; Current3DWorld.AddGeometric3DObject(AssociatedText); // TmpVol.AddText(TmpVol.Name, Current3DWorld, (double)Obj.ForText.numericUpDownArrowScale.Value, Obj.ForText.buttonChangeColorPositive.BackColor); } if (Obj.checkIsBoxPointingArrow.Checked) { cGeometric3DObject AssociatedArrow = TmpVol.AttachPointingArrow((double)Obj.ForArrow.numericUpDownArrowScale.Value, Obj.ForArrow.buttonChangeColorPositive.BackColor); Current3DWorld.AddGeometric3DObject(AssociatedArrow); } Obj.AssociatedBiologicalObjectList[i].SetOpacity((double)Obj.ColorOpacity.numericUpDownValue.Value); // if the object it the Master then create a meta-object and put it inside if (Obj.IsMasterObject()) { cMetaBiologicalObject Cell = new cMetaBiologicalObject(Obj.WindowForMaster.textBoxName.Text + i, Current3DWorld.ListMetaObjectList[0], Obj.AssociatedBiologicalObjectList[i]); // // Cell.AddObject(Obj.AssociatedBiologicalObjectList[i]); Current3DWorld.ListMetaObjectList[0].Add(Cell); } } if (Obj.radioButtonColorSingle.Checked) Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Regular); else if (Obj.radioButtonColorRandom.Checked) Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Random); else if (Obj.radioButtonColorIndexed.Checked) Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Indexed); } } else if (Obj.RadioButtonIsSpot.Checked) { cSpotDetection Detection = new cSpotDetection(SeqToAnalyse, (int)Obj.numericUpDownChannel.Value); if ((Obj.checkBoxPreProcessings.Checked == false) || (Obj.WindowForPreProcessing.checkBoxMedianIsDisabled.Checked)) { Detection.SetMedian(-1); Detection.SetShift(new cPoint3D(0, 0, 0)); } else { Detection.SetMedian((int)Obj.WindowForPreProcessing.numericUpDownMedianKernel.Value); Detection.SetShift(new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value)); } if ((Obj.comboBoxContainer.Items.Count > 0) && (Obj.comboBoxContainer.SelectedItem != null)) { Detection.SetContainers(Current3DWorld.GetListBiologicalObjectsOfType(Obj.comboBoxContainer.SelectedItem.ToString())); if (Obj.InOrOut.radioButtonIn.Checked) Detection.SetContainersMode(0); else Detection.SetContainersMode(1); } Obj.AssociatedBiologicalObjectList = Detection.HessianDetection((float)Obj.WindowForSpotDetection.numericUpDownSpotRadius.Value, (float)Obj.WindowForSpotDetection.numericUpDownIntensityThreshold.Value, (int)Obj.WindowForSpotDetection.numericUpDownSpotLocality.Value, (double)Obj.WindowForSpotDetection.numericUpDownSphereDisplayRadius.Value); Obj.richTextBoxInfo.AppendText(Obj.AssociatedBiologicalObjectList.Count + " objects detected."); for (int i = 0; i < Obj.AssociatedBiologicalObjectList.Count; i++) { cBiologicalSpot TmpSpot = (cBiologicalSpot)Obj.AssociatedBiologicalObjectList[i]; TmpSpot.Name = Obj.textBoxName.Text + " " + i; TmpSpot.SetType(Obj.textBoxName.Text); // TmpSpot.ThumbnailnewImage = imageListForThumbnail.Images[Obj.AssociatedBiologicalObjectList[i].GetType() + ".jpg"]; // if (Obj.checkBoxIsDisplayName.Checked) // TmpSpot.AddText(TmpSpot.Name, Current3DWorld, (double)Obj.ForText.numericUpDownArrowScale.Value, Obj.ForText.buttonChangeColorPositive.BackColor); if (Obj.checkIsBoxPointingArrow.Checked) { cGeometric3DObject AssociatedArrow = TmpSpot.AttachPointingArrow((double)Obj.ForArrow.numericUpDownArrowScale.Value, Obj.ForArrow.buttonChangeColorPositive.BackColor); Current3DWorld.AddGeometric3DObject(AssociatedArrow); } // TmpSpot.SetOpacity((double)Obj.ColorOpacity.numericUpDownValue.Value); // // if the object it the Master then create a meta-object and put it inside if (Obj.IsMasterObject()) { cMetaBiologicalObject Cell = new cMetaBiologicalObject("Cell " + i, Current3DWorld.ListMetaObjectList[0], Obj.AssociatedBiologicalObjectList[i]); // // Cell.AddObject(Obj.AssociatedBiologicalObjectList[i]); Current3DWorld.ListMetaObjectList[0].Add(Cell); } // /*cMetaBiologicalObject Cell = */ // //Current3DWorld.ListMetaObjectList[0].AssociateWith(Current3DWorld.ListMetaObjectList[0].FindTheClosestVolumeFrom(TmpSpot.GetCentroid(), 20), TmpSpot); } // if (Obj.radioButtonColorSingle.Checked) // Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Regular); // else if (Obj.radioButtonColorRandom.Checked) // Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Random); // else if (Obj.radioButtonColorIndexed.Checked) // Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Indexed); } else if (Obj.radioButtonIsVolumeRendering.Checked) { Current3DWorld.AddVolume3D(new cVolumeRendering3D(this.AssociatedImage.SingleChannelImage[(int)Obj.numericUpDownChannel.Value], new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value), null, Current3DWorld)); // cVolume3D Volume = new cVolume3D(SeqToAnalyse, (int)Obj.numericUpDownChannel.Value, new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value)); // Current3DWorld.AddVolume3D(Volume, Color.Black, Obj.buttonChangeColorPositive.BackColor); } // Thread oThread = new Thread(new ThreadStart(Obj.DisplayDone)); } #endregion #region Objects Association cMetaBiologicalObjectList MetaCellList = Current3DWorld.ListMetaObjectList[0]; // let's associate the objects for (int k = 0; k < ListFormForControl.Count; k++) { FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k -1); // that's a volume rendering ... no connection if (Obj.radioButtonIsVolumeRendering.Checked) continue; // the object is the master if (Obj.IsMasterObject()) continue; // this object has not connections ... is not associated to the master if (Obj.comboBoxLinkToTheMaster.SelectedIndex == 0) continue; cPoint3D ClosestPt = new cPoint3D(0, 0, 0); foreach (cBiological3DVolume CurrentSubObj in Obj.AssociatedBiologicalObjectList) { cBiological3DVolume ObjectToIdentify = null; switch (Obj.comboBoxLinkToTheMaster.SelectedIndex) { case 1: // association by distance to the master centroid ObjectToIdentify = MetaCellList.FindTheClosestVolumeCentroidFrom(CurrentSubObj.GetCentroid(), (double)Obj.WindowDistanceToMaster.numericUpDownDistanceMaxToMaster.Value); break; case 2: // //cBiological3DVolume CurrentVolume ObjectToIdentify = MetaCellList.FindTheClosestVolumeFrom(CurrentSubObj, (double)Obj.WindowDistanceToMaster.numericUpDownDistanceMaxToMaster.Value, out ClosestPt); break; default: break; } if (ObjectToIdentify == null) continue; cMetaBiologicalObject Cell = MetaCellList.AssociateWith(ObjectToIdentify, CurrentSubObj); // // -------------- draw information and links between the objects --------------------- if (Obj.WindowDistanceToMaster.checkBoxDrawLinkToMasterCenter.Checked) { c3DLine CurrLine = new c3DLine(CurrentSubObj.GetCentroid(), ObjectToIdentify.GetCentroid()); Current3DWorld.AddGeometric3DObject(CurrLine); //if (Obj.WindowDistanceToMaster.checkBoxDisplayBranchToCenterDistance.Checked) // CurrLine.DisplayLenght(Current3DWorld, 0.4); } // // -------------- draw information and links between the objects --------------------- if (Obj.WindowDistanceToMaster.checkBoxDrawLinkToMasterEdges.Checked) { c3DLine CurrLine1 = new c3DLine(CurrentSubObj.GetCentroid(), ClosestPt); Current3DWorld.AddGeometric3DObject(CurrLine1); //if(Obj.WindowDistanceToMaster.checkBoxDisplayBranchToEdgesDistance.Checked) // CurrLine1.DisplayLenght(Current3DWorld, 0.4); } } } #endregion #region Post Processings for (int k = 0; k < ListFormForControl.Count; k++) { FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k - 1); // the object is the master // // if (!Obj.IsMasterObject()) continue; if (!Obj.WindowForMaster.checkBoxDrawAssociatedDelaunay.Checked) continue; foreach (cMetaBiologicalObject CurrentMeta in MetaCellList) { Current3DWorld.AddGeometric3DObject(CurrentMeta.GenerateDelaunay(2.0f,true)); } } if (PostProcessWindow.checkBoxRemoveUnAssociatedObjects.Checked) { int RemovedObjects = Current3DWorld.RemoveNonAssociatedObjects(); Console.WriteLine(RemovedObjects + " objects removed."); } // if (PostProcessWindow.checkBoxExportMetaObjectSignatures.Checked) // { // if (CurrentTable == null) // { // CurrentTable = new DataTable(); // if (CurrentExperiment == null) // CurrentTable.Columns.Add(new DataColumn("Image Idx", typeof(int))); // else // { // CurrentTable.Columns.Add(new DataColumn("Image Col.", typeof(int))); // CurrentTable.Columns.Add(new DataColumn("Image Row", typeof(int))); // } // CurrentTable.Columns.Add(new DataColumn("Meta Object Name", typeof(string))); // foreach (string DescName in MetaCellList[0].GetSignatureNames()) // CurrentTable.Columns.Add(new DataColumn(DescName, typeof(double))); // CurrentTable.Columns.Add(new DataColumn("Class", typeof(double))); // } // foreach (cMetaBiologicalObject CurrentMeta in MetaCellList) // { // List<double> CurrentSignature = CurrentMeta.GetSignature(); // CurrentTable.Rows.Add(); // if (CurrentExperiment == null) // { // CurrentTable.Rows[CurrentTable.Rows.Count - 1][0] = IdxImageProcessed; // CurrentTable.Rows[CurrentTable.Rows.Count - 1][1] = CurrentMeta.Name; // for (int Idx = 0; Idx < CurrentSignature.Count; Idx++) // CurrentTable.Rows[CurrentTable.Rows.Count - 1][Idx + 2] = CurrentSignature[Idx]; // } // else // { // CurrentTable.Rows[CurrentTable.Rows.Count - 1][0] = CurrentExperiment.Column; // CurrentTable.Rows[CurrentTable.Rows.Count - 1][1] = CurrentExperiment.Row; // CurrentTable.Rows[CurrentTable.Rows.Count - 1][2] = CurrentMeta.Name; // for (int Idx = 0; Idx < CurrentSignature.Count; Idx++) // CurrentTable.Rows[CurrentTable.Rows.Count - 1][Idx + 3] = CurrentSignature[Idx]; // } // // Current3DWorld.CopyMetaObjectSignatureToTable(CurrentMeta, 0); // } // if (DataGrid != null) // { // DataGrid.dataGridViewForResults.DataSource = CurrentTable; // DataGrid.Update(); // IdxImageProcessed++; // } // } #endregion // //CurrentTable = new DataTable(); // if (CurrentExperiment == null) // { // if (PostProcessWindow.checkBoxDisplayBottomPlate.Checked) Current3DWorld.DisplayBottom(Color.FromArgb(255, 255, 255)); // Current3DWorld.SetBackgroundColor(PostProcessWindow.buttonChangeColorPositive.BackColor); // Current3DWorld.Render(); // } // // Current3DWorld.SetLinkToDataGridView(dataGridViewForClassif); cViewer3D V3D = new cViewer3D(); V3D.SetInputData(Current3DWorld); V3D.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(V3D.GetOutPut()); DTW.Run(); DTW.Display(); }
public void SetInputData(cImage MyData) { this.Input = MyData; }
public void SetInputData(cImage Input) { this.Input = Input; }
// protected override void on //protected override void OnFormClosing(FormClosingEventArgs e) //{ // AssociatedImage.Dispose(); // // base.OnFormClosing(e); //} public void Unsafe_SetAssociatedImage(cImage Im) { this.AssociatedImage = Im; }