<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(@&quot;G:\Master Degree\DataSet\case2\DICOM\PA1\ST1\SE2&quot;);</div>
<div><br></div><div>                // Display some image information</div><div>                Console.WriteLine(String.Format(&quot;Name={0}&quot;, input.Name));</div><div>                Console.WriteLine(String.Format(&quot;PixelType={0}&quot;, input.PixelType));</div>
<div>                Console.WriteLine(String.Format(&quot;Dimension={0}&quot;, input.Dimension));</div><div>                Console.WriteLine(String.Format(&quot;Size={0}&quot;, input.Size));</div><div>                Console.WriteLine(String.Format(&quot;Spacing={0}&quot;, input.Spacing));</div>
<div>                Console.WriteLine(String.Format(&quot;Origin={0}&quot;, input.Origin));</div><div>                Console.WriteLine(String.Format(&quot;Buffer={0}&quot;, 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(@&quot;c\label.mhd&quot;);</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>