[Insight-users] Loading a CT Volume in C# - SimpleITK or ITK

Jason Gibbs jdgibbs at gmail.com
Thu Sep 5 18:11:22 EDT 2013


Hello,

I am writing a pure C# based application and first started out using the
SimpleITKCSharpManaged assembly. I'm attempting to load a DICOM image from
a folder.  It is known the folder contains only one series.  However, I'm
having trouble ordering the files correctly.

Doing this loads an image, but the slices are all out of order:
  var FilesInFolder = Directory.EnumerateFiles(m_folder).ToList();

                    itk.simple.ImageSeriesReader reader = new
itk.simple.ImageSeriesReader();
                    itk.simple.VectorString vs = new
itk.simple.VectorString();

                    foreach (var file in FilesInFolder)
                        vs.Add(file);
                    reader.SetFileNames(vs);

                    m_ITKImg = reader.Execute();

I realize that I need something along the lines of GetGDCMSeriesFileNames
to order the files correctly. It seems this is a public static member of
itk.simple.ImageSeriesReader. However this does not seem to appear in the
assembly metadata (below). Is there something I'm missing or a different
route to achieve the same end result of loading the image in C#? I'm
assuming that others have loaded CT volumes in the C# wrapper before so I'm
guessing it's something I'm doing incorrectly. Thank you for any help!

Jason Gibbs


#region Assembly SimpleITKCSharpManaged.dll, v2.0.50727 //
C:\Users\jgibbs\Documents\Visual Studio
2010\Projects\DisplayDICOM\DisplayDICOM\SimpleITKCSharpManaged.dll
#endregion using System; namespace itk.simple { public class
ImageSeriesReader : IDisposable { protected bool swigCMemOwn; public
ImageSeriesReader(); public virtual void Dispose(); public Image Execute();
public VectorString GetFileNames(); public ImageSeriesReader
SetFileNames(VectorString fns); } }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130905/016c698d/attachment.htm>


More information about the Insight-users mailing list