Page MenuHomePhabricator

No saveBaseData without dialogs
Closed, ResolvedPublic


Extend mitkIOUtil to save base data.

Event Timeline


fixed problem

zelzer added a subscriber: zelzer.Jul 5 2013, 4:31 PM

The fixes for this will also fix T13455.

zelzer added a comment.Jul 6 2013, 4:20 PM

[42a286]: Merge branch 'bug-15480-add-savebasedata-in-ioutil'

Merged commits:

2013-07-05 16:30:10 Sascha Zelzer [3e2fb1]
Added simple test case for mitk::IOUtil::SaveBaseDate().

2013-07-05 16:14:58 Sascha Zelzer [d39839]
Fixed handling of base file names and extensions.

Parts of the image writer code made different assumptions about the
structure of the m_FileName member (containing the extension or not).

2013-07-03 14:15:25 Sascha Zelzer [aba7a7]
Added a SaveBaseData(mitk::BaseData*,...) method to IOUtil.

2013-07-03 14:14:31 Sascha Zelzer [f278ee]
Make the mitk::ImageWriter inherit from mitk::FileWriterWithInformation.

zelzer added a comment.Jul 6 2013, 4:20 PM

New remote branch pushed: bug-15480-add-savebasedata-in-ioutil

zelzer added a comment.Jul 6 2013, 6:45 PM

[babfe9]: Merge branch 'bug-15480-add-savebasedata-in-ioutil'

Merged commits:

2013-07-06 18:41:07 Sascha Zelzer [c163dc]
COMP: ImageWriter::GetFileName() now always returns the full name.

[679758]: Merge branch 'bug-15480-add-savebasedata-in-ioutil'

Merged commits:

2013-07-10 17:48:54 Jan Hering [4dc04f]
Fixed saving of base data types through QmitkIOUtil

Now saving of images is not possible at all, I'll doublecheck this new problem and report to this bug.
First, the motivation of this bug remains unclear, what is the point to save base data?
Is this an flexible extension checking for different data types? Then T8209 should be related to this bug, since this will automatically solve it.

The saving images problem seems to be related to a problem we had in DIPP:

we have stumbled upon an problem with saving files using MITK.

Image files are not saved (Windows 7, QT 4.8.4) because QFileDialog::getSaveFileName (in QmitkIOUtil
::GetFileNameWithQDialog()) always returns a file name with an “.pic,” attached to the end and therefore mitkImageWriter neglects it as no valid extension.

The windows dialog (qfiledialog_win.h) called by QFileDialog always(!) adds “.pic,”; it is irrelevant if the proposed file name has already an extension. So the default file name is “[yourFilePath].nrrd.pic,” and the extension checked and rejected by mitkImageWriter is “.nrrd.pic,”.

Is this a known bug already? It is not fixed by the patches for T15480 and T13455.

If not, I would file a bug.

One detail:

The filter string passed to QT is
"Image (*.pic, *.pic.gz, *.bmp, *.dcm, *.DCM, *.dicom, *.DICOM, *.gipl, *.gipl.gz, *.mha, *.nii, *.nii.gz, *.nrrd, *.nhdr, *.png, *.PNG, *.spr, *.mhd, *.vtk, *.vti, *.hdr, *.png, *.tif, *.jpg)"

qt_make_filter_list splits on „;;“ or „\n“.

Then qt_win_extract_filter tries to extract the filters, splits at „ “ and concats all items with „;“.

This results in the following filter string:

Which explains the “.pic,”

A question rises, without the guarantee to remove the problem completely: Should the filter string of the mitkImageWriter should be QT compliant?
This would be
“Image (*.pic *.pic.gz *.bmp *.dcm *.DCM *.dicom *.DICOM *.gipl *.gipl.gz *.mha *.nii *.nii.gz *.nrrd *.nhdr *.png *.PNG *.spr *.mhd *.vtk *.vti *.hdr *.png *.tif *.jpg)” (so without comma).

we used this to be able to store data in a given format. This is used to generate temporary files for the command line module.

zelzer added a comment.Aug 7 2013, 2:44 PM

It might be that this problem is Windows specific (as Sarah is mentioning). I have been working on that together with Jan Hering on a Linux machine and saving images definitely "worked".

Thanks for the context, I'll check this issue on my windows maschine and try to get a viable solution.

One further question, why the FileDialogPattern in mitk::ImageWriter still contains *.pic and *.pic.gz, those formats are deprecated since a while and the write support was stopped already.

New remote branch pushed: bug-15480-SavingOfImagesDoesntWork

[a66151]: Merge branch 'bug-15480-SavingOfImagesDoesntWork'

Merged commits:

2013-08-14 13:14:18 Jan Hering [51c9c4]
Merge remote-tracking branch 'origin/bug-15480-SavingOfImagesDoesntWork' into bug-15480-SavingOfImagesDoesntWork

2013-08-07 18:10:11 Sven Mersmann [8567cc]
Added some necessary file extension checking for two-parted extensions.

2013-08-07 15:48:22 Sven Mersmann [e8fa71]
Remove unsupproted image extensions and misleading "," in file dialog pattern.