Hello,<div><br></div><div>I have another question about the HDR file. The following code implements a simple operation, reading an HDR image file and writing it exactly to a new HDR image file.</div><div><br></div><div><div>
typedef int InternalPixelType;</div><div> const unsigned int Dimension = 3;</div><div> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;</div><div> typedef unsigned char OutputPixelType;</div>
<div> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;</div></div><div><br></div><div> </div><div> typedef itk::ImageFileReader< InternalImageType > ReaderType; </div><div> ReaderType::Pointer reader = ReaderType::New();<br>
reader->SetFileName( "input.hdr" );<span class="Apple-tab-span" style="white-space:pre">                </span></div><div> reader->Update();</div><div><br></div><div><div> typedef itk::CastImageFilter< InternalImageType, OutputImageType > CastingFilterType; </div>
<div> CastingFilterType::Pointer caster = CastingFilterType::New();</div></div><div> caster->SetInput( reader->GetOutput() );</div><div> caster->Update();</div><div><br></div><div><br></div><div> typedef itk::ImageFileWriter<OutputImageType> WriterType; </div>
<div> WriterType::Pointer writer = WriterType::New();</div><div> writer->SetFileName( "output.hdr" );</div><div> writer->SetInput( caster->GetOutput() );</div><div> writer->Update();</div><div>
<br></div><div><br></div><div>However, the result HDR file is damaged, while the associated IMG file is fine. When I tried to open the HDR file in MRIcro, it showed that "Unknown image format, the file size is smaller than described in "Header information" panel. " If the result is written in TIFF format, it would be fine. Only the HDR file works incorrectly.</div>
<div><br></div><div>Could you give me some suggestion of how to fix this error? </div><div><br></div><div>Sincerely,</div><div>Jianxu Chen</div>