[Insight-users] Loading a CT Volume in C# - SimpleITK or ITK
Jason Gibbs
jdgibbs at gmail.com
Fri Sep 6 12:34:13 EDT 2013
Brad,
Thank you for the response! I'm pretty sure that global functions aren't
allowed in C# so it would have to be shoved into some class somewhere, with
the natural one being ImageSeriesReader.
I did search through the assembly for any "GDCM" substring in the object
browser; no luck. For now I've wrapped the function on my own and it works
fine. However I'd be interested if anyone has a more elegant solution
moving forward.
Thanks again!
Jason
On Fri, Sep 6, 2013 at 12:16 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>wrote:
> Hello Jason,
>
> You are correct that you need a method like
> ImageSeriesReader::GetGDCMSeriesFilenames()[1] which is a static member
> function in C++.
>
> I am not certain, but I believe SWIG translate these static member methods
> to global functions with names such
> as ImageSeriesReader_GetGDCMSeriesFilenames. But hopefully you can search
> for that function name and find it in the assembly.
>
> Please let up know if you figure it out,
> Brad
>
> [1]
> http://www.itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1ImageSeriesReader.html#a26da9041bf5efd3db05524258de15dc2
>
> On Sep 5, 2013, at 6:11 PM, Jason Gibbs <jdgibbs at gmail.com> wrote:
>
> 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); } }
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130906/e9129683/attachment.htm>
More information about the Insight-users
mailing list