[Insight-users] output of segmentation to DICOM
Luis Ibanez
luis.ibanez at kitware.com
Sat Mar 6 19:57:39 EST 2010
Hi InfoSeekerr,
As it was pointed in the vtk users list,
You probably should use a filename:
c:\label.mhd
instead of your current filename:
"c\label.mhd"
Regards,
Luis
-------------------------------------
On Tue, Mar 2, 2010 at 4:52 PM, InfoSeekerr <ali.mahmoud.habib at gmail.com> wrote:
>
> while trying to read the output of WatershedType file , how can I fix that.
> because I need the output file for vtk output
>
>
> itk::ERROR: MetaImageIO(18160008): File cannot be written: c\label.mhd
> Reason: No such file or directory
> Location: void __thiscall itk::MetaImageIO::Write(const void *)
> File: ..\..\..\Code\IO\itkMetaImageIO.cxx
> Line: 1396
> at itk.itkImage_SS3.Write(String filename)
> at itk.itkImage.Write(String filename)
> at ConsoleApplication1.Program.Main(String[] args) in C:\Users\Eng. Ali
> Mahmo
> ud\Documents\Visual Studio
> 2005\Projects\ConsoleApplication1\ConsoleApplication1
> \Program.cs:line 52
>
> I used the following code :
>
> try
> {
> Console.WriteLine(DateTime.Now.ToShortTimeString());
> // read the DICOm series
> itkImageBase input = itkImage_SS3.New();
>
> // Read the DICOM image from the given directory
> input.ReadDicomDirectory(@"G:\Master
> Degree\DataSet\case2\DICOM\PA1\ST1\SE2");
>
> // Display some image information
> Console.WriteLine(String.Format("Name={0}", input.Name));
> Console.WriteLine(String.Format("PixelType={0}",
> input.PixelType));
> Console.WriteLine(String.Format("Dimension={0}",
> input.Dimension));
> Console.WriteLine(String.Format("Size={0}", input.Size));
> Console.WriteLine(String.Format("Spacing={0}",
> input.Spacing));
> Console.WriteLine(String.Format("Origin={0}",
> input.Origin));
> Console.WriteLine(String.Format("Buffer={0}",
> input.Buffer));
>
> ImageType label = itkImage.New(input.PixelType,
> input.Dimension);
>
> // Watershed
> WatershedType filterWatershed = WatershedType.New(input);
> filterWatershed.SetInput(input);
> filterWatershed.Threshold = 0.05;
> filterWatershed.Level = 0.8;
> filterWatershed.Update();
>
> // Relabel
> RelabelType filterRelabel = RelabelType.New(label, label);
> filterRelabel.SetInput(filterWatershed.GetOutput());
> filterRelabel.Update();
> filterRelabel.GetOutput(label);
> input.DisconnectPipeline();
> label.DisconnectPipeline();
>
> // Write the label image to disk
> label.Write(@"c\label.mhd");
>
>
>
>
> }
> catch (Exception ex)
> {
> Console.WriteLine(ex.ToString());
> }
> Console.WriteLine(DateTime.Now.ToShortTimeString());
> Console.ReadLine();
>
> }
>
>
More information about the Insight-users
mailing list