I&#39;m failing at trying to write a DICOM series in a specified folder.<div>Check out the code below. I&#39;m explicitly setting the folder &quot;extDicom&quot; as output directory.</div><div>Yet, the files are always written to the current working directory where the application is in.</div>
<div>Regardless of the folder I&#39;m telling the NamesGenerator...</div><div>What am I doing wrong?<br><div><br></div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #006640"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #9e0069">typedef</span><span style="color: #000000"> itk::</span>GDCMImageIO<span style="color: #000000"> </span>ImageIOType<span style="color: #000000">;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #006640"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #9e0069">typedef</span><span style="color: #000000"> itk::</span>GDCMSeriesFileNames<span style="color: #000000"> </span>NamesGeneratorType<span style="color: #000000">;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="text-decoration: underline ; color: #9e0069">typedef</span><span style="text-decoration: underline"> </span><span style="text-decoration: underline ; color: #9e0069">unsigned</span><span style="text-decoration: underline"> </span><span style="text-decoration: underline ; color: #9e0069">short</span><span style="text-decoration: underline"> OutputPixelType;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #9e0069">const</span> <span style="color: #9e0069">unsigned</span> OutputDimension = 2;</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #9e0069">typedef</span> itk::<span style="color: #006640">Image</span>&lt;OutputPixelType, OutputDimension&gt; <span style="color: #006640">Image2DType</span>;</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #006640"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span><span style="color: #9e0069">typedef</span><span style="color: #000000"> itk::</span>ImageSeriesWriter<span style="color: #000000">&lt;</span>ItkImageType<span style="color: #000000">, </span>Image2DType<span style="color: #000000">&gt; </span>SeriesWriterType<span style="color: #000000">;</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #006640"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>ImageIOType<span style="color: #000000">::</span>Pointer<span style="color: #000000"> gdcmIO = </span>ImageIOType<span style="color: #000000">::New();</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #006640"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>SeriesWriterType<span style="color: #000000">::Pointer writer = </span>SeriesWriterType<span style="color: #000000">::New();</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;SetInput(<span style="color: #2400d0">itkImage</span>);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;SetImageIO(gdcmIO);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #006640"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>NamesGeneratorType<span style="color: #000000">::</span>Pointer<span style="color: #000000"> namesGenerator = </span>NamesGeneratorType<span style="color: #000000">::New();</span></p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>namesGenerator-&gt;SetOutputDirectory(<span style="color: #4e00ff">&quot;extDicom&quot;</span>);</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #9e0069">const</span> <span style="color: #006640">SeriesWriterType</span>::FileNamesContainer &amp; filenames = namesGenerator-&gt;GetOutputFileNames();</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;SetFileNames(filenames);</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;SetMetaDataDictionary(<span style="color: #2400d0">itkImage</span>-&gt;GetMetaDataDictionary());</p>

<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><br></p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;Update();</p></div></div>