Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, February 22, 2017 11:16:04 AM(UTC)

ehk  
ehk

Groups: Registered
Posts: 15


Hello,

I have followed this example :
https://www.leadtools.co...withmprviewtutorial.html

I am adding the following line to it :
Code:

control3D.AxialFrame.Data3DRequested += new EventHandler<MedicalViewerData3DRequestedEventArgs>(AxialFrame_Data3DRequested);


And I am adding this function :

Code:

private void AxialFrame_Data3DRequested(object sender, MedicalViewerData3DRequestedEventArgs e)
{
  MedicalViewerBaseCell cell = sender as MedicalViewerBaseCell;
  string labelName = DateTime.Now + " *";

  cell.SetTag(3, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.UserData, labelName);

}



After running; StachOverflowException is throwen by AxialFrame_Data3DRequested() method and label can't be set.
Do you know why?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, February 22, 2017 2:54:20 PM(UTC)

Aaron  
Aaron

Groups: Registered, Tech Support, Administrators
Posts: 71

Was thanked: 4 time(s) in 3 post(s)

Hi,

The issue here is that the Data3DRequested event fires any time the cell itself requests any data, so you are actually calling SetTag many times when the form attempts to load. You could see this by either putting a breakpoint on the cell.SetTag method call and stepping through the code or simply putting a counter in the AxialFrame_Data3DRequested. Calling the SetTag method over and over again is what is causing the stack overflow exception. It looks like you may be just setting the time in the tag overlay text. If so, you could do that when the form loads just once after all the cells have been added to the viewer. I added the following to the end of the InitClass method from the tutorial link you provided:

Code:

string labelName = DateTime.Now + " *";
foreach (var cell in viewer.Cells)
{
   cell.SetTag(3, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.UserData, labelName);
}


Which will set the current time as an overlay tag on each cell:

SetTag Time Overlay Added

If this is not what you are trying to achieve, could you give me any further information on why you are wanting to use the Data3DRequested event to set the cell tag overlays? Or maybe some further information on what functionality you are attempting to achieve with the Data3DRequested event and the SetTag method call so that I can assist you further in implementing the functionality that you want?

Edited by moderator Monday, February 24, 2020 10:32:03 AM(UTC)  | Reason: Not specified

Aaron Brasington
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Thursday, February 23, 2017 3:14:09 AM(UTC)

ehk  
ehk

Groups: Registered
Posts: 15


Thanks for your quick reply.

We are using several dynamic labels [specific description per image] and we need to refresh them every time when related cells are changed or scrolled.
So Data3DRequested event was at this time a good option to use for our dynamic labels.

 
#4 Posted : Thursday, February 23, 2017 11:30:36 AM(UTC)

Aaron  
Aaron

Groups: Registered, Tech Support, Administrators
Posts: 71

Was thanked: 4 time(s) in 3 post(s)

I think I understand now. However, the Data3DRequested is just firing too many times to be able to update the cell tag in this manner (which is causing the StackOverflowException on the SetTag call). A better option may be to try using the UIChanged event. This event would fire any time the user interacts with the cell. I hooked into this event in the tutorial you mentioned and the tag seems to update correctly any time the user interacts with the cell:

Code:

control3D.AxialFrame.UIChanged += new EventHandler<MedicalViewerUIChangedEventArgs>(AxialFrame_UIChanged);

Code:

private void AxialFrame_UIChanged(object sender, MedicalViewerUIChangedEventArgs e)
{
   MedicalViewerBaseCell cell = sender as MedicalViewerBaseCell;
   string labelName = DateTime.Now + " *";

   cell.SetTag(3, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.UserData, labelName);
}


Aaron Brasington
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.104 seconds.