/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { // Declare variables int M = 0; IGH_Goo X = null; IGH_Goo Y = null; double P = 0.5; // Access the input parameters if (!DA.GetData(0, ref X)) { return; } if (!DA.GetData(1, ref Y)) { return; } if (!DA.GetData(2, ref M)) { return; } if (!DA.GetData(3, ref P)) { return; } Bitmap A = null; Bitmap B = null; if (X != null) { X.CastTo(out A); } if (Y != null) { Y.CastTo(out B); } Bitmap C = new Bitmap(A); if ((A.Width != B.Width) || (A.Height != B.Height)) { mMatchBitmaps BitmapPair = new mMatchBitmaps(A, B, MatchType, MatchSizing); A = new Bitmap(BitmapPair.BottomImage); B = new Bitmap(BitmapPair.TopImage); } switch (M) { case 0: C = new mCompositeAdd(A, B).ModifiedBitmap; break; case 1: C = new mCompositeSubtract(A, B).ModifiedBitmap; break; case 2: C = new mCompositeDifference(A, B).ModifiedBitmap; break; case 3: C = new mCompositeIntersect(A, B).ModifiedBitmap; break; case 4: C = new mCompositeFlatField(A, B).ModifiedBitmap; break; case 5: C = new mCompositeMerge(A, B).ModifiedBitmap; break; case 6: C = new mCompositeMorph(A, B, P).ModifiedBitmap; break; case 7: C = new mCompositeMove(A, B, (int)P).ModifiedBitmap; break; case 8: C = new mDifferenceThreshold(A, B, (int)P).ModifiedBitmap; break; case 9: C = new mDifferenceEuclidean(A, B, (int)P).ModifiedBitmap; break; } DA.SetData(0, C); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { // Declare variables int M = 0; IGH_Goo X = null; IGH_Goo Y = null; int P = 50; // Access the input parameters if (!DA.GetData(0, ref M)) { return; } if (!DA.GetData(1, ref X)) { return; } if (!DA.GetData(2, ref Y)) { return; } if (!DA.GetData(3, ref P)) { return; } Bitmap A = null; Bitmap B = null; if (X != null) { X.CastTo(out A); } if (Y != null) { Y.CastTo(out B); } Bitmap C = new Bitmap(A); if ((A.Width != B.Width) || (A.Height != B.Height)) { mMatchBitmaps BitmapPair = new mMatchBitmaps(A, B, MatchType, MatchSizing); A = new Bitmap(BitmapPair.BottomImage); B = new Bitmap(BitmapPair.TopImage); } switch (M) { case 0: C = new mDifferenceThreshold(A, B, P).ModifiedBitmap; break; case 1: C = new mDifferenceEuclidean(A, B, P).ModifiedBitmap; break; } DA.SetData(0, C); }