LEADTOOLS Support
Medical
Medical SDK Questions
How to delete all annotation objects in MedicalViewerCell
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, March 5, 2009 4:42:21 PM(UTC)
Groups: Registered
Posts: 59
Hi
What must I do if I want to delete all annotation objects in a MedicalViewerCell before drawing a new annotation object so that there is only one annotation object in MedicalViewerCell at any time. For example, I draw a rectangle object on my Image. Then I draw a new rectangle object on this very image. But I want to see only one new rectangle but not two(the old existed rectangle before and the new I have drawn)
I have tried write code at AnnotationCreated Event of MedicalViewer like that
void _medicalViewer_AnnotationCreated(object sender, MedicalViewerAnnotationCreatedEventArgs e)
{
Leadtools.Annotations.AnnContainer AnnContainer;
AnnContainer = _medicalViewer.Cells[CellIndex].GetAnnotationContainer();
AnnContainer.Objects.Clear();
_medicalViewer.Cells[CellIndex].Invalidate();
_medicalViewer.Invalidate();
_medicalViewer.Update();
}
But after this event, All object is not cleared from my Image
Can you help me to remain only new drawn annotation object on my Image
Thanks in advance!
#2
Posted
:
Monday, March 9, 2009 11:23:05 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
How many cells do you have? If you have more than 1 cell, try calling GetAnnotationContainer(cellIndex) and then clearing the container. By the way, what version of the toolkit are you using?
#3
Posted
:
Monday, March 9, 2009 10:41:44 PM(UTC)
Groups: Registered
Posts: 59
I have only one cell. and I have tried to GetAnnotationContainer(cellIndex) to get AnnContainer. But as I said, After I use Method Clear() of AnnContainer Object. All Ann Objects did not disappear from my Image.
That's my problem. Please Help me to solve this as soon as possible
Thanks in advance!
#4
Posted
:
Friday, March 13, 2009 4:05:26 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
I'm currently checking on this with some of the other agents here. But as a work around I was able to empty the container by passing in an empty one like this: medicalViewer1.Cells[0].SetAnnotationContainer(new AnnContainer());
#5
Posted
:
Sunday, March 15, 2009 4:30:44 PM(UTC)
Groups: Registered
Posts: 59
Thanks
I applied your hint and solved this problem well
Thanks again and have a nice day!
#6
Posted
:
Monday, March 16, 2009 4:55:15 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Just to confirm the solution, the GetAnnotationContainer() returns a copy of the annotation container. It does not return a reference to the annotation container object. So the above solution of passing in an empty container is correct. If you wanted to only modify/add objects to the annotation container you would do that with the container returned by GetAnnotationContainer(). Then you set that container back with SetAnnotationContainer. Like this:
AnnContainer tempContainer = medicalViewer.Cells[0].GetAnnotationContainer();
tempContainer.Objects.Add(someAnnotationObject); // add my annotation object
medicalViewer.Cells[0].SetAnnotationContainer(tempContainer);
#7
Posted
:
Tuesday, August 31, 2010 1:20:16 AM(UTC)
Groups: Registered
Posts: 59
LEADTOOLS Support
Medical
Medical SDK Questions
How to delete all annotation objects in MedicalViewerCell
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.