<div dir="ltr"><div>Dear All,</div><div><br></div>while trying to read the output of WatershedType file , how can I fix that. because I need the output file for vtk output <div><br></div><div><br></div><div><div>itk::ERROR: MetaImageIO(18160008): File cannot be written: c\label.mhd</div>
<div>Reason: No such file or directory</div><div>Location: void __thiscall itk::MetaImageIO::Write(const void *)</div><div>File: ..\..\..\Code\IO\itkMetaImageIO.cxx</div><div>Line: 1396</div><div> at itk.itkImage_SS3.Write(String filename)</div>
<div> at itk.itkImage.Write(String filename)</div><div> at ConsoleApplication1.Program.Main(String[] args) in C:\Users\Eng. Ali Mahmo</div><div>ud\Documents\Visual Studio 2005\Projects\ConsoleApplication1\ConsoleApplication1</div>
<div>\Program.cs:line 52</div><div><br></div><div>I used the following code :</div><div><br></div><div><div>try</div><div> {</div><div> Console.WriteLine(DateTime.Now.ToShortTimeString());</div><div>
// read the DICOm series </div><div> itkImageBase input = itkImage_SS3.New();</div><div><br></div><div> // Read the DICOM image from the given directory </div><div> input.ReadDicomDirectory(@"G:\Master Degree\DataSet\case2\DICOM\PA1\ST1\SE2");</div>
<div><br></div><div> // Display some image information</div><div> Console.WriteLine(String.Format("Name={0}", input.Name));</div><div> Console.WriteLine(String.Format("PixelType={0}", input.PixelType));</div>
<div> Console.WriteLine(String.Format("Dimension={0}", input.Dimension));</div><div> Console.WriteLine(String.Format("Size={0}", input.Size));</div><div> Console.WriteLine(String.Format("Spacing={0}", input.Spacing));</div>
<div> Console.WriteLine(String.Format("Origin={0}", input.Origin));</div><div> Console.WriteLine(String.Format("Buffer={0}", input.Buffer));</div><div><br></div><div> ImageType label = itkImage.New(input.PixelType, input.Dimension);</div>
<div><br></div><div> // Watershed</div><div> WatershedType filterWatershed = WatershedType.New(input);</div><div> filterWatershed.SetInput(input);</div><div> filterWatershed.Threshold = 0.05;</div>
<div> filterWatershed.Level = 0.8;</div><div> filterWatershed.Update();</div><div><br></div><div> // Relabel</div><div> RelabelType filterRelabel = RelabelType.New(label, label);</div>
<div> filterRelabel.SetInput(filterWatershed.GetOutput());</div><div> filterRelabel.Update();</div><div> filterRelabel.GetOutput(label);</div><div> input.DisconnectPipeline();</div>
<div> label.DisconnectPipeline();</div><div><br></div><div> // Write the label image to disk</div><div> label.Write(@"c\label.mhd");</div><div><br></div><div> </div>
<div> </div><div><br></div><div> }</div><div> catch (Exception ex)</div><div> {</div><div> Console.WriteLine(ex.ToString());</div><div> }</div><div>
Console.WriteLine(DateTime.Now.ToShortTimeString());</div><div> Console.ReadLine();</div><div><br></div><div> }</div></div><div><br></div><div><br></div></div></div>