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 : Monday, February 10, 2020 6:11:25 AM(UTC)

DevBRG  
DevBRG

Groups: Registered
Posts: 1


I'm experimenting creating a small viewer for DICOM images and clips (a few hundreds of frames). The idea is to be able to switch easily from frame to frame using keyboard or the mouse wheel.

I am using ImageViewer, and DicomDataSet classes

According to the DicomDataSet documentation, DicomDataSet.GetImages() can be used to load a sequence of frames.

However, the return value is one single RasterImage.

If I display the RasterImage obtained in the ImageViewer
Code:
 viewer.Image = image;
, I see only the first frame. The viewer has some methods to switch pages, but the RasterImage has only one page.

Code:
 
private RasterImage LoadDicomImage(string basePath, string fileName)
{           
            string dicomPath = Path.Combine(basePath, fileName);
            RasterImage image;
            using (var fileStream = new FileStream(dicomPath, FileMode.Open, FileAccess.Read))
            using (var dataSet = new DicomDataSet())
            {
                dataSet.Load(fileStream, Leadtools.Dicom.DicomDataSetLoadFlags.None);

                DicomElement pixelDataElement = dataSet.FindFirstElement(null, DicomTag.PixelData, true);
                Console.WriteLine($"{dataSet.GetImageCount(pixelDataElement)} pixeldata element found"); // here I get for instance "104" with some example DICOM

                image = dataSet.GetImages(pixelDataElement, 0, dataSet.GetImageCount(pixelDataElement), 0, RasterByteOrder.Gray, DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut);
           }

            DicomEngine.Shutdown();

            return image;
}


What is the preferred way(s) of making the ImageViewer switch from frame to frame in the RasterImage returned by DicomDataSet.GetImages() ?
 

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 : Tuesday, February 11, 2020 5:20:04 PM(UTC)
Matthew Bresson

Groups: Registered, Tech Support, Administrators
Posts: 26


Hello Yohann,

I have received your support ticket and I have begun to look into your inquiry. I will provide information as soon as I have an update. If you have any further remarks on this inquiry in the meantime, please feel free to reach out to me.

Thanks,
Matt Bresson
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS
 
#3 Posted : Wednesday, February 12, 2020 5:03:53 PM(UTC)
Matthew Bresson

Groups: Registered, Tech Support, Administrators
Posts: 26


Hello Yohann,

For your specific use case I would recommend looking into using the MouseWheel Event inside the Systems.Windows namespace. Please note the information provided in the links below is not from the LEADTOOLS website, but does appear to address your inquiry. Please note that this information has not been vetted by LEADTOOLS and you should take any necessary precautions prior to implementing any of the suggestions provided. Use any information at your own risk.
https://docs.microsoft.c...el?view=netframework-4.8
https://docs.microsoft.c...ta?view=netframework-4.8
Do note that you will have to cast it as a FrameworkElement as the event is not natively supported in WPF. You can add a condition that whenever the Delta property changes by like 10 or so you can indicate to the ImageViewer that you want to change the page of the RasterImage. To change the current active page for your RasterImage use the Page Property.
https://www.leadtools.co.../l/rasterimage-page.html

You can use something like the code snippet below. As a disclaimer, I have not tested the snippet below, it is just to demonstrate the information I provided. If you have any further questions on the implementation of the information above I would need to create a sample project and test it.

Code:

int i = 0;
if (e.Delta < 0)
{
    i--;
    RasterImage.Page = i;
}
else if (e.Delta > 0)
{
    i++;
    RasterImage.Page = i;
}

i = the RasterImage's current page number.
Always ensure that the index and your current page number match each other when a change occurs.

Please let me know if you have any further questions.

Thanks
Matt Bresson
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS
 
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-2020, Yet Another Forum.NET
This page was generated in 0.148 seconds.