Page 1 of 1

Draw multi rectangle selections

Posted: Fri May 05, 2023 1:09 pm
by gianni.sanzone
Good morning,

I would like to know if the library provides to draw multi rectangle or elliptical selections.
If this stuff isn't there, how can i build a work-around?

Thanks

Re: Draw multi rectangle selections

Posted: Fri May 05, 2023 2:05 pm
by Alex
Hello Gianni,

If you want to create custom selection region in image viewer, you need to use the CustomSelectionTool visual tool. Please read more info here: https://www.vintasoft.com/docs/vsimagin ... _Tool.html

Best regards, Alexander

Re: Draw multi rectangle selections

Posted: Fri May 05, 2023 3:55 pm
by gianni.sanzone
Hi Alex,

Sorry, pheraphs i didn't write well the question.
I'd like to draw several selections on imageviewer (therefore show all these selections on imageviewer) and edit each selection.

I make an example:
I draw [hardcoded] three area selections with this code:

Code: Select all

      var rectTool = new RectangularSelectionToolWithCopyPaste();
      var rectTool1 = new RectangularSelectionToolWithCopyPaste();
      var rectTool2 = new RectangularSelectionToolWithCopyPaste();
      var ellipseTool = new CustomSelectionTool();
      imageBox.VisualTool = new CompositeVisualTool(rectTool, rectTool1,rectTool2, ellipseTool);
      rectTool.Rectangle = new System.Drawing.Rectangle(0, 0, 100, 100);
      rectTool1.Rectangle = new System.Drawing.Rectangle(100, 100, 500, 500);
      rectTool2.Rectangle = new System.Drawing.Rectangle(500, 500, 500, 500);
      ellipseTool.Selection = new EllipticalSelectionRegion(new System.Drawing.Rectangle(99, 1200, 700,300));
I see these selections on imageviewer but i can't risize or drag them: In VisualTools of imageViewer i see three selections and "user interaction visual tool".
If i try to move a selection, the cursor changes and i start to draw a new selection.

How can i resize and move a drawn selection?

Re: Draw multi rectangle selections

Posted: Sat May 06, 2023 3:47 pm
by Alex
Hi Gianni,

Please do the following test:
1. Run VintaSoft Imaging Demo ("[SdkInstallPath]\VintaSoft\Imaging .NET v12.1\Bin\DotNet4\AnyCPU\ImagingDemo.exe").
2. Open image.
3. Click "Custom selection" button in toolbar and build the custom selection on image in viewer.
4. Transform (move, rotate, resize, mirror, etc) the custom selection in viewer.

If custom selection suits your needs, please see source code of VintaSoft Imaging Demo in installation of VintaSoft Imaging .NET SDK.

If custom selection does not suit your needs, please send me more info about your task.

Best regards, Alexander

Re: Draw multi rectangle selections

Posted: Wed May 10, 2023 11:33 am
by gianni.sanzone
Hi Alexander,

I can't use customselectiontool because i don't want to draw some rectangles in a selection.
I don't want transform just a rectangle or an ellipse. I want to draw and show severals ROIs in the image viewer.
In this image https://we.tl/t-crCLxUhqJ5, you can see 4 different selections ( A, B, C, D ).

I have drawn A,B,C ROIs by code but i can't tranform them beacause when i try to resize the C Shape ( for example ), the cursors change and draw a new selection.

I would like to draw each selection one by one in image viewer and i would like to transform them one by one.

Is it possibile do it?

Thank you

Re: Draw multi rectangle selections

Posted: Wed May 10, 2023 2:14 pm
by Alex
Hi Gianni,

For solving your task please use the AnnotationViewer with rectangle/ellipse annotations. This is the simplest way.

You can evaluate the annotation functionality in VintaSoft Annotation Demo ("[SdkInstallPath]\VintaSoft\Imaging .NET v12.1\Bin\DotNet4\AnyCPU\AnnotationDemo.exe").

Best regards, Alexander

Re: Draw multi rectangle selections

Posted: Thu May 11, 2023 10:48 am
by gianni.sanzone
Hi Alex,

thank you!

Gianni