<p class="MsoNormal">Hi all, <br></p>
<p class="MsoNormal"><span style=""> </span>I have some dicom
files that are probably in compressed format as they are<br>much smaller than other files of same slice size (512x512x1)
in the same folder<br>and there is <span style=""></span>a tag
(0008,2111) called derivative description found in these files with value <br>"Compress BN JPEG Lossless".<span style="">
</span>The problem I encountered is that when reading <br>these files using itk::GDCMImageIO, I
receive the following message:</p>
<p class="MsoNormal"><span style=""> </span>"Must
downscale data from 16 bits to 12"</p>
<p class="MsoNormal">To make things worse, sometimes my program aborts when
trying to access data read<br>from these files or it returns the wrong intensity values.<span style=""> However I am able to read<br>these files using MATLAB and other programs</span>. Below is the dicom reading part of my ITK code which is based on </p>
<p class="MsoNormal"><span style="">
</span>Insight/Examples/IO/DicomSeriesReadImageWrite.cxx</p>
<p class="MsoNormal"> typedef itk::ImageSeriesReader< ImageType > ReaderType;<br> ReaderType::Pointer reader = ReaderType::New();<br><br> typedef itk::GDCMImageIO ImageIOType;<br> ImageIOType::Pointer dicomIO = ImageIOType::New();<br>
reader->SetImageIO( dicomIO );<br><br> typedef itk::GDCMSeriesFileNames NamesGeneratorType;<br> NamesGeneratorType::Pointer nameGenerator = NamesGeneratorType::New();<br> nameGenerator->SetUseSeriesDetails( true );<br>
nameGenerator->SetRecursive(true);<br> nameGenerator->SetDirectory(inputFolder);<br><br> typedef std::vector< std::string > SeriesIdContainer;<br> const SeriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();<br>
SeriesIdContainer::const_iterator seriesItr = seriesUID.begin();<br> SeriesIdContainer::const_iterator seriesEnd = seriesUID.end();<br><br> std::string seriesIdentifier;<br> typedef std::vector< std::string > FileNamesContainer;<br>
FileNamesContainer fileNames;<br> while( seriesItr != seriesEnd ){<br> seriesIdentifier = seriesItr->c_str();<br> fileNames = nameGenerator->GetFileNames( seriesIdentifier );<br> reader->SetFileNames( fileNames );<br>
reader->Update();<br> image = reader->GetOutput();<br> // ...<br> }<br><br><span style=""></span></p>
<p class="MsoNormal">The same code works well for other uncompressed dicom files
in the same folder.<br>I found similar questions have been asked in the mailing
list, for example,<br><span style="">
</span><a href="http://www.cmake.org/pipermail/insight-users/2007-April/021955.html">http://www.cmake.org/pipermail/insight-users/2007-April/021955.html</a><br>However, in my case, adding<br><span style="">
</span>dicomIO->UseCompressionOn();<br><span style="">
</span>dicomIO->SetCompressionType(itk::GDCMImageIO::JPEG2000); // I also
tried JPEG<br><span style=""> </span>does not solve the
problem.</p>
<p class="MsoNormal"> <br>I guess I must have missed some obvious solution and would appreciate
any clue that will help me out.<span style=""> <br></span>Many
thanks in advance and wish you all have a great holiday!</p>
<p class="MsoNormal"> <br>Bing</p>