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, June 28, 2017 10:26:46 AM(UTC)
Nick Villalobos

Groups: Registered, Manager, Tech Support, Administrators
Posts: 75

Was thanked: 2 time(s) in 2 post(s)

Attached you will find a console application that loads in a Dicom file and prints out the module count, module name, each element within the module and more. This is very similar to the module list viewing from the Dicom Demo that can found here:

  • C:\LEADTOOLS 19\Examples\DotNet\CS\DicomDemo


The core to this project is simply a nested for loop that loops through one module at a time then will retrieve each element within that module. You can view that code below:

Code:

//Loop through each module in the dataset
for (int j = 0; j <= totalModules - 1; j++)
{
   module = dataSet.FindModuleByIndex(j);

   string s =
      $"Module Number: {j + 1}\n" +
      $"Module Type: {module.Type.ToString()}\n" +
      $"Module Element Count: {module.Elements.Length}\n\n";

   Console.WriteLine(s);

   //Loop through each element within the module
   for (int i = 0; i <= module.Elements.Length - 1; i++)
   {
      element = module.Elements[i];

      DicomTag tag = DicomTagTable.Instance.Find(element.Tag);

      output =
     $"Element Name: {tag.Name}\n" +
     $"Tag: {element.Tag} \n" +
     $"VR: {element.VR.ToString()}\n";

      Console.WriteLine(output);
   }
}



File Attachment(s):
Dicom_ReadModulesElements.zip (2,936kb) downloaded 138 time(s).
Nick Villalobos
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

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.

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-2017, Yet Another Forum.NET
This page was generated in 0.110 seconds.