Hi, i'm trying to saving a DICOM file into another DICOM file with some transformation like IntensityWindowingImageFilterType adapted from the <a href="http://www.itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM">http://www.itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM</a> example. The only problem that occurs it the "brightness" doesn't change on the new DICOM file created during the process but the "contrast" changes is ok. This snippet of code corresponds the moment that occurs the passage of parameters to the transformation of the IntensityWindowingImageFilterType and the moment that is written a new DICOM file.<br clear="all">
<div><br></div><div><div>//////////////////////////////////////////////// </div><div>// "filter" is the type IntensityWindowingImageFilterType</div></div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre">        </span>rescaler->SetInput(reader->GetOutput());</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>rescaler->SetOutputMinimum( 0 ); //rescaler default to view the original colors [0,255]</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>rescaler->SetOutputMaximum( 255 ); //</div>
<div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter->SetInput(rescaler->GetOutput());//</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>filter->SetWindowLevel(intMaxWindowGlobal, intMinWindowGlobal); //(window, level)</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>//parameters from a Dialog created by the main class</div><div> <span class="Apple-tab-span" style="white-space:pre">        </span>filter->SetWindowMinimum(intMinWindowGlobal);//Minimum Contrast</div>
<div> <span class="Apple-tab-span" style="white-space:pre">        </span>filter->SetWindowMaximum(intMaxWindowGlobal);//Maximum Contrast</div><div> <span class="Apple-tab-span" style="white-space:pre">        </span>filter->SetOutputMinimum(intOutMinGlobal);//Minimum Brightness<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div> <span class="Apple-tab-span" style="white-space:pre">        </span>filter->SetOutputMaximum(intOutMaxGlobal);//Maximum Brightness</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>try</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> filter->Update();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> }</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> catch( itk::ExceptionObject & err )</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> std::cerr << "ExceptionObject caught !" << std::endl;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> std::cerr << err << std::endl;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> }</div></div><div><br></div><div>
<br></div><div><br></div><div><div>//////////////////////////////////////////////// </div><div>// 5) Write the new DICOM series</div><div><br></div><div> // Generate the file names</div><div> OutputNamesGeneratorType::Pointer outputNames = OutputNamesGeneratorType::New();</div>
<div> std::string seriesFormat("/home/brennobr/Source/dcm-files/teste-resample/output");</div><div> seriesFormat = seriesFormat + "/" + "IM%d.dcm";</div><div> outputNames->SetSeriesFormat (seriesFormat.c_str());</div>
<div> outputNames->SetStartIndex (1);</div><div> outputNames->SetEndIndex (outputSize[2]);</div><div> </div><div> SeriesWriterType::Pointer seriesWriter = SeriesWriterType::New();</div><div> seriesWriter->SetInput( filter->GetOutput() );</div>
<div> seriesWriter->SetImageIO( gdcmIO );</div><div> seriesWriter->SetFileNames( outputNames->GetFileNames() );</div><div> seriesWriter->SetMetaDataDictionaryArray( &outputArray );</div><div> try</div>
<div> {</div><div> seriesWriter->Update();</div><div> }</div><div> catch( itk::ExceptionObject & excp )</div><div> {</div><div> std::cerr << "Exception thrown while writing the series " << std::endl;</div>
<div> std::cerr << excp << std::endl;</div><div> }</div><div> std::cout << "The output series in directory " << "/home/brennobr/Source/dcm-files/teste-resample/output"</div>
<div> << " has " << outputSize[2] << " files with spacing "</div><div> << outputSpacing</div><div> << std::endl;</div></div><div><br></div>
<div><br></div><div><br></div>-- <br><div>Brenno Bernardes Ribeiro<br><br>Engenharia da Computação</div><div>
Universidade Federal do Pará</div><div style="padding:0px;overflow:hidden;margin-left:0px;margin-top:0px;color:black;font-size:10px;text-align:left;line-height:130%"></div>