[Insight-users] output of WatershedType error
Ali Habib
ali.mahmoud.habib at gmail.com
Tue Mar 2 16:50:16 EST 2010
Dear All,
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();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100302/53af4044/attachment.htm>
More information about the Insight-users
mailing list