MantisBT - ITK
View Issue Details
0000444ITKpublic2003-12-17 14:422003-12-19 13:47
nicolas.savoire 
Lydia Ng 
lowminoralways
closedfixed 
 
 
0000444: Filename not changed when writing multiple mhd files to disk
I use an ImageFileWriter to write several files in mhd format. I change the input and the filename for each file between updates. The name of the mhd file is correctly updated, but the name of the associated raw file remains the same one (corresponding to the first write).

Example code:
    writer->SetInput(...);
    writer->SetFileName("a.mhd");
    writer->Update();

    writer->SetInput(...);
    writer->SetFileName("b.mhd");
    writer->Update();

    writer->SetInput(...);
    writer->SetFileName("c.mhd");
    writer->Update();

This code will produce 3 files: a.mhd b.mhd c.mhd, but only one raw file: a.raw.

I tracked the source of the bug down to the file metaImage.cxx in the method Write. The test line 808:
if(_dataName == NULL && strlen(m_ElementDataFileName)==0)
implies that if m_ElementDataFileName has already been set (which is the case in my example) then it is not updated, which explains the bug.
No tags attached.
Issue History

Notes
(0000380)
Lydia Ng   
2003-12-19 13:47   
This bug has been fixed in the 1.4 branch and will appear in 1.4.1 release.

In the meantime the patched 1.4 branch can be obtained via cvs. Please see www.itk.org/HTML/Download.htm for instructions.