<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I am still having further problems with resampling a DICOM image and have adapted the ResampleDICOM example in order to resample a PET image from 512x512 to 128x128.<div><br></div><div>The output of DICOM files are not correct as they simply return a DICOM image with 0 everywhere. I seem to be absolutely stuck on this. I have had to forcibly set the origin and spacing as this doesn’t seem to be automatically extracted from the files.</div><div><br></div><div>The same code (changing only the PixelType typedef to unsigned char) works perfectly for resampling CT images but not for my PET images. Can anyone help me with this as I am getting fairly frustrated with it all!</div><div><br></div><div>(Note, there is some use of Qt stuff in here too)</div><div><br></div><div>Can anyone see why this does not work for resampling PET DICOM? </div><div><br></div><div>Regards, Nick.</div><div><br></div><div><br></div><div>
<pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkVersion.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkImage.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkMinimumMaximumImageFilter.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkGDCMImageIO.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkGDCMSeriesFileNames.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkNumericSeriesFileNames.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkImageSeriesReader.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkImageSeriesWriter.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkResampleImageFilter.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkShiftScaleImageFilter.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkIdentityTransform.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"itkLinearInterpolateImageFunction.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><itksys/SystemTools.hxx></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#if</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">ITK_VERSION_MAJOR</span><span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">4</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"gdcmUIDGenerator.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"gdcm/src/gdcmFile.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"gdcm/src/gdcmUtil.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#endif</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><string></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"RaydoseManager.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><iostream></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">using</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">namespace</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">static</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>CopyDictionary<span style=" color:#c0c0c0;"> </span>(<span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataDictionary</span><span style=" color:#c0c0c0;"> </span>&fromDict,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataDictionary</span><span style=" color:#c0c0c0;"> </span>&toDict);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">RaydoseManager</span><span style=" color:#c0c0c0;"> </span>*RDManager<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">RaydoseManager</span>::GetManager();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">RaydoseResampleDICOM</span>::RaydoseResampleDICOM(<span style=" color:#800080;">RaydoseSeries</span>*<span style=" color:#c0c0c0;"> </span>parent,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>x,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>y)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Calculate</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">X</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">and</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Y</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">pixel</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">width</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">based</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">on</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">supplied</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">scale</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">factors.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">parentSeries</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>parent;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>cout<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>parent->GetModality().toStdString()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pixelXWidth</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>(<span style=" color:#800000;">parentSeries</span>->GetXPixWidth())*x;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pixelYWidth</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>(<span style=" color:#800000;">parentSeries</span>->GetYPixWidth())*y;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>Resample();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">RaydoseResampleDICOM</span>::Resample()<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>InputDimension<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">3</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>OutputDimension<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">2</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">short</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">PixelType;</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">PixelType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">Image</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">PixelType</span>,<span style=" color:#c0c0c0;"> </span>InputDimension<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">Image</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">PixelType</span>,<span style=" color:#c0c0c0;"> </span>OutputDimension<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">OutputImageType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">ImageSeriesReader</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">GDCMImageIO</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ImageIOType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">GDCMSeriesFileNames</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputNamesGeneratorType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">NumericSeriesFileNames</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">OutputNamesGeneratorType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">IdentityTransform</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">double</span>,<span style=" color:#c0c0c0;"> </span>InputDimension<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">TransformType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">LinearInterpolateImageFunction</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">double</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InterpolatorType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">ResampleImageFilter</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ResampleFilterType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">ShiftScaleImageFilter</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ShiftScaleType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">ImageSeriesWriter</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">OutputImageType</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">SeriesWriterType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">1)</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Read</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">input</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>image<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ImageIOType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>gdcmIO<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ImageIOType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputNamesGeneratorType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>inputNames<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputNamesGeneratorType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>inputNames->SetInputDirectory(<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">parentSeries</span>->GetDirectoryPath().toLocal8Bit()<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800080;">FileNamesContainer</span><span style=" color:#c0c0c0;"> </span>&<span style=" color:#c0c0c0;"> </span>filenames<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>inputNames->GetInputFileNames();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>reader<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>reader->SetImageIO(<span style=" color:#c0c0c0;"> </span>gdcmIO<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>reader->SetFileNames(<span style=" color:#c0c0c0;"> </span>filenames<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">try</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>reader->Update();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">catch</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#800080;">itk</span>::<span style=" color:#800080;">ExceptionObject</span><span style=" color:#c0c0c0;"> </span>&excp)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::cerr<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"Exception</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">thrown</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">while</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">reading</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::cerr<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>excp<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">EXIT_FAILURE</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>image<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>reader->GetOutput();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">////////////////////////////////////////////////</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">2)</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Resample</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InterpolatorType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>interpolator<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InterpolatorType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">TransformType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>transform<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">TransformType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>transform->SetIdentity();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">InputImageType::SpacingType&</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">inputSpacing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">reader->GetOutput()->GetSpacing();</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">double</span><span style=" color:#c0c0c0;"> </span>*inputSpacing<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">double</span>[<span style=" color:#000080;">3</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">parentSeries</span>->GetXPixWidth();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">parentSeries</span>->GetYPixWidth();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">parentSeries</span>->GetSliceThickness();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">RegionType</span>&<span style=" color:#c0c0c0;"> </span>inputRegion<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>reader->GetOutput()->GetLargestPossibleRegion();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">SizeType</span>&<span style=" color:#c0c0c0;"> </span>inputSize<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>inputRegion.GetSize();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">SpacingType</span><span style=" color:#c0c0c0;"> </span>outputSpacing;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pixelXWidth</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pixelYWidth</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">2</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span>changeInSpacing<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">false</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">for</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;<span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">3</span>;<span style=" color:#c0c0c0;"> </span>i++)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(outputSpacing[i]<span style=" color:#c0c0c0;"> </span>==<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0.0</span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSpacing[i]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>inputSpacing[i];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>changeInSpacing<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">SizeType</span><span style=" color:#c0c0c0;"> </span>outputSize;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">SizeType</span>::<span style=" color:#800080;">SizeValueType</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">SizeValueType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSize[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">static_cast</span><<span style=" color:#800080;">SizeValueType</span>>(inputSize[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>*<span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>/<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">.5</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSize[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">static_cast</span><<span style=" color:#800080;">SizeValueType</span>>(inputSize[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>*<span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>/<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">.5</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputSize[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">static_cast</span><<span style=" color:#800080;">SizeValueType</span>>(inputSize[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>*<span style=" color:#c0c0c0;"> </span>inputSpacing[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>/<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">.5</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800080;">DictionaryRawPointer</span><span style=" color:#c0c0c0;"> </span>inputDict<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>(*(reader->GetMetaDataDictionaryArray()))[<span style=" color:#000080;">0</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800080;">DictionaryArrayType</span><span style=" color:#c0c0c0;"> </span>outputArray;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>originFirstPixel;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::ExposeMetaData<std::string>(*inputDict,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"0020|0032"</span>,<span style=" color:#c0c0c0;"> </span>originFirstPixel);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>firstPixelPostion(originFirstPixel.c_str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">double</span><span style=" color:#c0c0c0;"> </span>*origin<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">double</span>[<span style=" color:#000080;">3</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>origin[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>firstPixelPostion.mid(<span style=" color:#000080;">0</span>,firstPixelPostion.indexOf(<span style=" color:#008000;">"\\"</span>)).toDouble();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>origin[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>firstPixelPostion.mid(firstPixelPostion.indexOf(<span style=" color:#008000;">"\\"</span>)+<span style=" color:#000080;">1</span>,</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>(firstPixelPostion.lastIndexOf(<span style=" color:#008000;">"\\"</span>)-firstPixelPostion.indexOf(<span style=" color:#008000;">"\\"</span>))-<span style=" color:#000080;">1</span>).toDouble();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>origin[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>firstPixelPostion.mid(firstPixelPostion.lastIndexOf(<span style=" color:#008000;">"\\"</span>)+<span style=" color:#000080;">1</span>,firstPixelPostion.length()).toDouble();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ResampleFilterType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>resampler<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ResampleFilterType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetInput(reader->GetOutput());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetTransform(transform);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetInterpolator(interpolator);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetOutputOrigin(origin);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetOutputSpacing(outputSpacing);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetOutputDirection(reader->GetOutput()->GetDirection());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->SetSize(outputSize);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->Update();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">////////////////////////////////////////////////</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">3)</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Create</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">a</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">MetaDataDictionary</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">for</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">each</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">slice.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Copy</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">dictionary</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">from</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">first</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">image</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">and</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">override</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">slice</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">specific</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">fields</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">To</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">keep</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">in</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">same</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">study</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">as</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">original</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">we</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">need</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">keep</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">same</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">study</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">UID.</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">But</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">we</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">need</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">and</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">frame</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">of</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">reference</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">UID's.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">#if</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">ITK_VERSION_MAJOR</span><span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">4</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">gdcm</span>::<span style=" color:#800080;">UIDGenerator</span><span style=" color:#c0c0c0;"> </span>suid;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>seriesUID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>suid.Generate();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">gdcm</span>::<span style=" color:#800080;">UIDGenerator</span><span style=" color:#c0c0c0;"> </span>fuid;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>frameOfReferenceUID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>fuid.Generate();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">#else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>std::string<span style=" color:#c0c0c0;"> </span>seriesUID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>gdcm::Util::CreateUniqueUID(<span style=" color:#c0c0c0;"> </span>gdcmIO->GetUIDPrefix());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>std::string<span style=" color:#c0c0c0;"> </span>frameOfReferenceUID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>gdcm::Util::CreateUniqueUID(<span style=" color:#c0c0c0;"> </span>gdcmIO->GetUIDPrefix());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">#endif</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>studyUID;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>sopClassUID;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::ExposeMetaData<std::string>(*inputDict,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"0020|000d"</span>,<span style=" color:#c0c0c0;"> </span>studyUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::ExposeMetaData<std::string>(*inputDict,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"0008|0016"</span>,<span style=" color:#c0c0c0;"> </span>sopClassUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>gdcmIO->KeepOriginalUIDOn();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">for</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>f<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;<span style=" color:#c0c0c0;"> </span>f<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span>outputSize[<span style=" color:#000080;">2</span>];<span style=" color:#c0c0c0;"> </span>f++)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Create</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">a</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">dictionary</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">for</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">this</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">slice</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800080;">DictionaryRawPointer</span><span style=" color:#c0c0c0;"> </span>dict<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ReaderType</span>::<span style=" color:#800080;">DictionaryType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Copy</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">dictionary</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">from</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">first</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">slice</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>CopyDictionary<span style=" color:#c0c0c0;"> </span>(*inputDict,<span style=" color:#c0c0c0;"> </span>*dict);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Set</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">UID's</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">for</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">study,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">SOP</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">and</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">frame</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">of</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">reference</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|000d"</span>,<span style=" color:#c0c0c0;"> </span>studyUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|000e"</span>,<span style=" color:#c0c0c0;"> </span>seriesUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|0052"</span>,<span style=" color:#c0c0c0;"> </span>frameOfReferenceUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">#if</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">ITK_VERSION_MAJOR</span><span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">4</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">gdcm</span>::<span style=" color:#800080;">UIDGenerator</span><span style=" color:#c0c0c0;"> </span>sopuid;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>sopInstanceUID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>sopuid.Generate();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">#else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>std::string<span style=" color:#c0c0c0;"> </span>sopInstanceUID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>gdcm::Util::CreateUniqueUID(<span style=" color:#c0c0c0;"> </span>gdcmIO->GetUIDPrefix());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">#endif</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0008|0018"</span>,<span style=" color:#c0c0c0;"> </span>sopInstanceUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0002|0003"</span>,<span style=" color:#c0c0c0;"> </span>sopInstanceUID);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Change</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">fields</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">that</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">are</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">slice</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">specific</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">itksys_ios</span>::<span style=" color:#800080;">ostringstream</span><span style=" color:#c0c0c0;"> </span>value;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>f<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Image</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Number</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|0013"</span>,<span style=" color:#c0c0c0;"> </span>value.str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Series</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Description</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">-</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Append</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">description</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">current</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">description</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>oldSeriesDesc;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::ExposeMetaData<std::string>(*inputDict,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"0008|103e"</span>,<span style=" color:#c0c0c0;"> </span>oldSeriesDesc);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>oldSeriesDesc<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">":</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Resampled</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">with</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">pixel</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">spacing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">",</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><<<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">",</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><<<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">2</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">unsigned</span><span style=" color:#c0c0c0;"> </span>lengthDesc<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>value.str().length();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>seriesDesc(<span style=" color:#c0c0c0;"> </span>value.str(),<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>,lengthDesc<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">64</span><span style=" color:#c0c0c0;"> </span>?<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">64</span>:<span style=" color:#c0c0c0;"> </span>lengthDesc);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0008|103e"</span>,<span style=" color:#c0c0c0;"> </span>seriesDesc);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Series</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Number</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1001</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|0011"</span>,<span style=" color:#c0c0c0;"> </span>value.str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Derivation</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Description</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">-</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">How</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">this</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">image</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">was</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">derived</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>lengthDesc<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>value.str().length();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>derivationDesc(<span style=" color:#c0c0c0;"> </span>value.str(),<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>,lengthDesc<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1024</span><span style=" color:#c0c0c0;"> </span>?<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1024</span><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span>lengthDesc);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0008|2111"</span>,<span style=" color:#c0c0c0;"> </span>derivationDesc);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Image</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Position</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Patient:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">This</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">is</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">calculated</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">by</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">computing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">physical</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">coordinate</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">of</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">first</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">pixel</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">in</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">each</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">slice.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">PointType</span><span style=" color:#c0c0c0;"> </span>position;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">InputImageType</span>::<span style=" color:#800080;">IndexType</span><span style=" color:#c0c0c0;"> </span>index;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>index[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>index[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>index[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>f;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>resampler->GetOutput()->TransformIndexToPhysicalPoint(index,<span style=" color:#c0c0c0;"> </span>position);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"\\"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"\\"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">2</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>cout<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"\\"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"\\"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span><<endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|0032"</span>,<span style=" color:#c0c0c0;"> </span>value.str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Slice</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Location:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">For</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">now,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">we</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">store</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">z</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">component</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">of</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Image</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Position</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Patient.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>position[<span style=" color:#000080;">2</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0020|1041"</span>,<span style=" color:#c0c0c0;"> </span>value.str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(changeInSpacing)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Slice</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Thickness:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">For</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">now,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">we</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">store</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">z</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">spacing</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value.str(<span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>outputSpacing[<span style=" color:#000080;">2</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0018|0050"</span>,value.str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Spacing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Between</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Slices</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(*dict,<span style=" color:#008000;">"0018|0088"</span>,value.str());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Save</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">dictionary</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputArray.push_back(dict);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">////////////////////////////////////////////////</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">4)</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Shift</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">data</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">undo</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">effect</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">of</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">a</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">rescale</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">intercept</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">by</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">DICOM</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">reader</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>interceptTag(<span style=" color:#008000;">"0028|1052"</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataObject</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">MetaDataStringType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataObjectBase</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>entry<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>(*inputDict)[interceptTag];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">MetaDataStringType</span>::<span style=" color:#800080;">ConstPointer</span><span style=" color:#c0c0c0;"> </span>interceptValue<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">dynamic_cast</span><<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">MetaDataStringType</span><span style=" color:#c0c0c0;"> </span>*>(<span style=" color:#c0c0c0;"> </span>entry.GetPointer()<span style=" color:#c0c0c0;"> </span>)<span style=" color:#c0c0c0;"> </span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>interceptShift<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span>(<span style=" color:#c0c0c0;"> </span>interceptValue<span style=" color:#c0c0c0;"> </span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>tagValue<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>interceptValue->GetMetaDataObjectValue();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>interceptShift<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>-atoi<span style=" color:#c0c0c0;"> </span>(<span style=" color:#c0c0c0;"> </span>tagValue.c_str()<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ShiftScaleType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>shiftScale<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ShiftScaleType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>shiftScale->SetInput(<span style=" color:#c0c0c0;"> </span>resampler->GetOutput());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>shiftScale->SetShift(<span style=" color:#c0c0c0;"> </span>interceptShift<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">////////////////////////////////////////////////</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">5)</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Write</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">DICOM</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>cout<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">The</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">problem</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">occurs</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">here</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">!!!"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Make</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">output</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">directory</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">and</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">generate</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">file</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">names.</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">char</span>*<span style=" color:#c0c0c0;"> </span>dirID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">char</span>[<span style=" color:#000080;">200</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>directoryID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>RDManager->GetInputPath()+<span style=" color:#800000;">parentSeries</span>->GetModality()+<span style=" color:#800000;">parentSeries</span>->GetDate().toString(<span style=" color:#008000;">"ddmmyyyy"</span>)+<span style=" color:#008000;">"_"</span>+</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">parentSeries</span>->GetTime().toString(<span style=" color:#008000;">"hhMMss"</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>dirID<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>directoryID.toLocal8Bit();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itksys</span>::<span style=" color:#800080;">SystemTools</span>::MakeDirectory(<span style=" color:#c0c0c0;"> </span>dirID<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>cout<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"Writing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">out</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">path:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>directoryID.toStdString()<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">Generate</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">file</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">names</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">OutputNamesGeneratorType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>outputNames<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">OutputNamesGeneratorType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>seriesFormat<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>directoryID;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#800000;">parentSeries</span>->GetModality()==<span style=" color:#008000;">"CT"</span>)<span style=" color:#c0c0c0;"> </span>{<span style=" color:#c0c0c0;"> </span>seriesFormat<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>seriesFormat<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"/"</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"CT%d.dcm"</span>;<span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span><span style=" color:#c0c0c0;"> </span>{<span style=" color:#c0c0c0;"> </span>seriesFormat<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>seriesFormat<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"/"</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"NM%d.dcm"</span>;<span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputNames->SetSeriesFormat<span style=" color:#c0c0c0;"> </span>(seriesFormat.toLocal8Bit());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputNames->SetStartIndex(<span style=" color:#000080;">1</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>outputNames->SetEndIndex(outputSize[<span style=" color:#000080;">2</span>]);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">SeriesWriterType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>seriesWriter<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">SeriesWriterType</span>::<span style=" color:#800000;">New</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>seriesWriter->SetInput(<span style=" color:#c0c0c0;"> </span>resampler->GetOutput()<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>seriesWriter->SetImageIO(<span style=" color:#c0c0c0;"> </span>gdcmIO<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>seriesWriter->SetFileNames(<span style=" color:#c0c0c0;"> </span>outputNames->GetFileNames()<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>seriesWriter->SetMetaDataDictionaryArray(<span style=" color:#c0c0c0;"> </span>&outputArray<span style=" color:#c0c0c0;"> </span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">try</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>seriesWriter->Update();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">catch</span>(<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">ExceptionObject</span><span style=" color:#c0c0c0;"> </span>&<span style=" color:#c0c0c0;"> </span>excp<span style=" color:#c0c0c0;"> </span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::cerr<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"Exception</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">thrown</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">while</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">writing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">series</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"</span><span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::cerr<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span>excp<span style=" color:#c0c0c0;"> </span><<<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::endl;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">EXIT_FAILURE</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">EXIT_SUCCESS</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>CopyDictionary<span style=" color:#c0c0c0;"> </span>(<span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataDictionary</span><span style=" color:#c0c0c0;"> </span>&fromDict,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataDictionary</span><span style=" color:#c0c0c0;"> </span>&toDict)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataDictionary</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">DictionaryType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">DictionaryType</span>::<span style=" color:#800080;">ConstIterator</span><span style=" color:#c0c0c0;"> </span>itr<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>fromDict.Begin();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">DictionaryType</span>::<span style=" color:#800080;">ConstIterator</span><span style=" color:#c0c0c0;"> </span>end<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>fromDict.End();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">typedef</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataObject</span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">MetaDataStringType</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">while</span>(<span style=" color:#c0c0c0;"> </span>itr<span style=" color:#c0c0c0;"> </span>!=<span style=" color:#c0c0c0;"> </span>end<span style=" color:#c0c0c0;"> </span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::<span style=" color:#800080;">MetaDataObjectBase</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>entry<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>itr->second;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">MetaDataStringType</span>::<span style=" color:#800080;">Pointer</span><span style=" color:#c0c0c0;"> </span>entryvalue<span style=" color:#c0c0c0;"> </span>=</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">dynamic_cast</span><<span style=" color:#800080;">MetaDataStringType</span><span style=" color:#c0c0c0;"> </span>*>(<span style=" color:#c0c0c0;"> </span>entry.GetPointer()<span style=" color:#c0c0c0;"> </span>)<span style=" color:#c0c0c0;"> </span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span>(<span style=" color:#c0c0c0;"> </span>entryvalue<span style=" color:#c0c0c0;"> </span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>tagkey<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>itr->first;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">std</span>::<span style=" color:#800080;">string</span><span style=" color:#c0c0c0;"> </span>tagvalue<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>entryvalue->GetMetaDataObjectValue();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">itk</span>::EncapsulateMetaData<std::string>(toDict,<span style=" color:#c0c0c0;"> </span>tagkey,<span style=" color:#c0c0c0;"> </span>tagvalue);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>++itr;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br><!--EndFragment--></pre><div><br></div><div><br></div><div><br></div></div></body></html>