MantisBT - ITK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0006159 | ITK | public | 2007-12-13 13:25 | 2007-12-14 10:58 | |
Reporter | sebastienfricker | ||||
Assigned To | Bill Lorensen | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | OS Version | |||
Product Version | |||||
Target Version | Fixed in Version | ||||
Resolution Date | |||||
Sprint | |||||
Sprint Status | |||||
Summary | 0006159: itkTIFFImageIO does not close opened file | ||||
Description | It is not possible to overwrite a TIFF file in-place, ie read a file at the beginning of a pipeline and write to the same file at the end. The reason is that the file reader never closes the file it reads. In addition, when the writer fails to write, it does so silently. See the following code in Itktiffimageio.cxx, in the TIFFImageIO::InternalWrite function: TIFF *tif = TIFFOpen(m_FileName.c_str(), "w"); if ( !tif ) { itkDebugMacro( << "Returning" ); return; } | ||||
Steps To Reproduce | |||||
Additional Information | Example code: //DEFINE IMAGE TYPES const unsigned int Dimension = 2; typedef unsigned short PixelType; typedef double InternalPixelType; typedef itk::Image< PixelType, Dimension > ImageType; typedef itk::Image< InternalPixelType, Dimension > InternalImageType; //READ INPUT IMAGE typedef itk::ImageFileReader< ImageType > ImageReaderType; ImageReaderType::Pointer inputImageReader = ImageReaderType::New(); inputImageReader->SetFileName( fileName ); inputImageReader->Update(); ImageType::Pointer inputImage = inputImageReader->GetOutput(); //RESAMPLE IMAGE //Define filter, create one instance typedef itk::ResampleImageFilter< InternalImageType, InternalImageType > ResampleFilterType; ResampleFilterType::Pointer resampler = ResampleFilterType::New(); resampler->SetInput( inputImage ); //MORE CODE HERE TO SET RESAMPLER PARAMETERS … //CAST IMAGE TO OUTPUT TYPE typedef itk::CastImageFilter< InternalImageType, ImageType > CastFilterType; CastFilterType::Pointer caster = CastFilterType::New(); caster->SetInput( resampler->GetOutput() ); //WRITE OUTPUT FILE typedef itk::ImageFileWriter< ImageType > WriterType; WriterType::Pointer writer = WriterType::New(); writer->SetFileName( fileName ); writer->SetInput( caster->GetOutput() ); writer->Update(); | ||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2007-12-13 13:25 | sebastienfricker | New Issue | |||
2007-12-13 13:34 | Bill Lorensen | Status | new => assigned | ||
2007-12-13 13:34 | Bill Lorensen | Assigned To | => Bill Lorensen | ||
2007-12-13 13:36 | Bill Lorensen | Note Added: 0009868 | |||
2007-12-13 13:36 | Bill Lorensen | Status | assigned => acknowledged | ||
2007-12-13 15:09 | Bill Lorensen | Status | acknowledged => resolved | ||
2007-12-13 15:09 | Bill Lorensen | Resolution | open => fixed | ||
2007-12-13 15:09 | Bill Lorensen | Note Added: 0009869 | |||
2007-12-14 10:58 | Bill Lorensen | Status | resolved => closed | ||
2007-12-14 10:58 | Bill Lorensen | Note Added: 0009890 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|