View Issue Details

IDProjectCategoryView StatusLast Update
0002326Slicer4Core: Base Codepublic2018-05-30 01:59
Reporterinorton Assigned Topieper  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.3.0 
Summary0002326: Save Data should always make unique filenames
Description

See screenshot.

TagsNo tags attached.

Relationships

related to 0003125 closedpieper Compressed Nifti files not stored properly in MRML 
related to 0003019 closedjcfr Renaming a node (1) does not update file name and (2) does not update modified status 
related to 0003890 acknowledgedpieper Renaming node in the scene changes the filename in the storage node 

Activities

2012-07-18 15:13

 

needuniques.png (47,243 bytes)
needuniques.png (47,243 bytes)
inorton

inorton

2013-05-14 10:30

developer   ~0008637

Still a problem.

pieper

pieper

2013-05-14 12:56

administrator   ~0008641

We discussed at the developer hangout making the filenames always track the node name.

http://www.slicer.org/slicerWiki/index.php/Developer_Meetings/20130514#To_discuss

pieper

pieper

2013-05-16 07:18

administrator   ~0008651

Please give r22004 a try and let me know if it doesn't do the trick.

inorton

inorton

2013-05-29 08:03

developer   ~0008683

This looks great - thanks!

finetjul

finetjul

2013-07-09 14:05

administrator   ~0008973

r22004 introduced the following pb:
1) Open "Download Sample Data" module
2) download MRHead

  • it downloads a file named "MR-Head.nrrd" in C:/Users/Julien/AppData/Local/Temp/RemoteIO/MR-Head.nrrd
    3) Open "Save data" dialog
    4) Save scene (-> don't save the volume).
    5) close scene
    6) load saved scene
    -> it tries to load the non existing file "C:/Users/Julien/AppData/Local/Temp/RemoteIO/MRHead.nrrd" (notice the missing '-')
pieper

pieper

2013-07-09 15:00

administrator   ~0008974

Interesting - I would say that is a special case and I wonder what we should do about it. What happens here is that the SampleData the loaded volume name doesn't match the filename. I guess there's an easy fix - I could just change the name of the temp file to match the volume name.

But still the use case that Julien pointed out could be problematic in other ways - basically the SampleData is stored in a transient directory and the scene could become invalid after a reboot. Probably the better thing would be to remove the storage node from the SampleData after loading so that the user will be explicitly prompted to save.

pieper

pieper

2013-07-09 15:01

administrator   ~0008975

Removed storage node from sample data downloads r22162

finetjul

finetjul

2013-07-09 15:20

administrator   ~0008976

I'm still not convinced :-)
1)a) Load a file from disk, in the "Add data" dialog, check the "options", change the node name to "fixed"
or
1)b) Load a file from disk, from the slice controller change the volume name to "fixed"
2) Save scene (don't check the volume)
3) close scene
4) reload scene
-> missing volume.

pieper

pieper

2013-07-09 15:40

administrator   ~0008977

Ah - I see what you mean! :o

Is there a place we can move this easily in the file dialog code? Basically I think we want to set the text that appears in the File Name column to match the node name - that way the storage node is only modified if the save takes place.

finetjul

finetjul

2013-07-10 04:17

administrator   ~0008978

Last edited: 2013-07-10 04:24

Specifying the file name for a node to save is done here:
https://github.com/Slicer/Slicer/blob/master/Base/QTGUI/qSlicerSaveDataDialog.cxx#L769

Effectively changing the node filename is done automatically here:
https://github.com/Slicer/Slicer/blob/master/Base/QTGUI/qSlicerSaveDataDialog.cxx#L771

Therefore, the filename table widget item contains the filename of the node to save. If the row is unchecked, then nothing happens to the node:
https://github.com/Slicer/Slicer/blob/master/Base/QTGUI/qSlicerSaveDataDialog.cxx#L709

So I believe what can be done is to change the initial value of the filename table widget item:
https://github.com/Slicer/Slicer/blob/master/Base/QTGUI/qSlicerSaveDataDialog.cxx#L624

I still don't think it will solve the "uniqueness" of filenames. What if 2 nodes have the same names (names are not uniques, only IDs are (actually IDs are not really unique (because of scene view nodes), but it's a different issue :-) )? if you write them, they will overwrite each others.
I believe this can be done in the fixupFileName() method (if a list of other filenames is given as parameter).

pieper

pieper

2013-07-10 05:16

administrator   ~0008979

Thanks for the pointers - I'll look into it.

I notice that a few tests are now failing because they assumed that the nodes loaded by sample data would still have storage nodes. I'll look into changing the tests so they don't make this assumption.

jcfr

jcfr

2013-07-13 00:41

administrator   ~0009040

Related commit: r22162
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22162

jcfr

jcfr

2013-07-13 00:42

administrator   ~0009041

Last edited: 2013-07-13 00:44

@Steve: Commit r22162 related to this issue seems sub-optimal, it is now causing the following tests to fail: py_vtkITKArchetypeScalarReaderFile and py_vtkITKArchetypeDiffusionTensorReaderFile
EDIT: I just read note 8979 and realized you are already aware of the problem.

pieper

pieper

2013-07-19 12:04

administrator   ~0009149

Issues related to r22162 fixed by r22217.

Original issue related to file renaming still under investigation.

pieper

pieper

2013-08-06 05:44

administrator   ~0009389

I think r22260 is a good compromise that handle the reported use cases.

finetjul

finetjul

2013-08-06 06:37

administrator   ~0009392

Nice fix !

Comments about r22259:
a) I agree with your TODO: such code could probably be moved in the Data module logic.
b) the new filename might contain forbidden characters
c) this does not handle filename uniqueness

Comments about r22260:
Marking the storable node as "modified" is not exactly what we mean. Instead, we should inform that the storage node is no longer pointing to the right file. This can be done by vtkMRMLStorageNode:: InvalidateFile().
Even better, maybe when changing the filename (vtkMRMLStorageNode::SetFileName), InvalidateFile() could be called automatically ?

pieper

pieper

2013-08-06 09:26

administrator   ~0009408

Thanks for the review J2 :)

Regarding r22259:
a) yes, eventually...
b) I tested some bad characters and the dialog box strips them already
c) No, but the user is prompted to avoid overwrite

Regarding r22260: maybe actually want vtkMRMLStorableNode::SetName to call this->StorableModifiedTime.Modified() since we have modified the storable node. I still think the right thing is to update the time stamp of the storable node itself is more logical, since that's the node the user actually did explicitly change. Invalidating the storage node is a side effect.

If you want we can leave this open but retarget for 4.4 since the current bad behavior has been fixed.

inorton

inorton

2013-08-28 12:24

developer   ~0009671

I think something might be goofy in the heuristic here, because I just saw an mrb with files called "xxx.nhdr.nrrd.nrrd.nrrd"

jcfr

jcfr

2014-03-06 05:22

administrator   ~0011175

Closing resolved issues that have not been updated in more than 3 months

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file ccdfdd31

2013-05-16 11:17:33

pieper

Details Diff
BUG: 0002326 make save dialog name match node name

With this change, the file save name will be made to match the
name of the node. This way when a user has specified a
meaningful name in the GUI it will be transferred to the
filename as well for consistency.

http://www.na-mic.org/Bug/view.php?id=2326#c8637

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22004 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/QTGUI/qSlicerSaveDataDialog.cxx Diff File

Slicer: 2145-support-for-installing-extension-from-file 2748442a

2013-07-09 19:00:39

pieper

Details Diff
BUG: 0002326 remove storage nodes for sample data downloads

Since the download is in a temp directory, make sure the user
is prompted to save when saving the scene.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22162 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Modules/Scripted/SampleData/SampleData.py Diff File

Slicer: 2145-support-for-installing-extension-from-file ce6c1b88

2013-07-19 16:04:05

pieper

Details Diff
BUG: 0002326 Fix tests and ENH: refactor sample data

The bug refers to failures of the py_vtkITKArchetypeScalarReaderFile
and py_vtkITKArchetypeDiffusionTensorReaderFile tests after
commit [1]. These tests relied on a side-effect of downloading
the sample data in order to determine the file to load
data from, but this was not reliable since the data was in a temp
directory. Now the tests request the download directly.

The enhancement is that the sample data module now supports the
concept of categories of sample data sources, such that modules
can register their sample data. This way a version of slicer can
offer sample data appropriate for use with the particular extensions
that have been installed.

[1] http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22162

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22217 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Libs/vtkITK/Testing/vtkITKArchetypeDiffusionTensorReaderFile.py Diff File
mod - Libs/vtkITK/Testing/vtkITKArchetypeScalarReaderFile.py Diff File
mod - Modules/Scripted/SampleData/SampleData.py Diff File

Slicer: 2145-support-for-installing-extension-from-file 2c0985ad

2013-08-06 09:43:58

pieper

Details Diff
BUG: 0002326 mark a node as modified if the name has changed

When the user has changed the name of a node this is
reflected in the suggested name of the file (see issue 0003125).
With this fix the node is also marked as modified so that
it will be checked for saving.

This means that changing the name of a node in the scene will
cause it to be saved to a new file on disk which is a slight change
in behavior and may cause people to use more disk space. But in
general I think this is safer and more clear, since file names will
always match the name of the node in the scene and users will
prefer that I believe.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22260 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/QTGUI/qSlicerSaveDataDialog.cxx Diff File
mod - Libs/MRML/Core/vtkMRMLStorableNode.h Diff File

Issue History

Date Modified Username Field Change
2012-07-18 15:13 inorton New Issue
2012-07-18 15:13 inorton File Added: needuniques.png
2012-08-20 08:25 nicole Assigned To => finetjul
2012-08-20 08:25 nicole Status new => assigned
2012-08-20 08:25 nicole Target Version => Slicer 4.3.0
2013-05-14 10:30 inorton Note Added: 0008637
2013-05-14 10:30 inorton Assigned To finetjul => kikinis
2013-05-14 12:55 pieper Assigned To kikinis => pieper
2013-05-14 12:56 pieper Note Added: 0008641
2013-05-14 12:56 pieper Status assigned => acknowledged
2013-05-16 07:18 pieper Note Added: 0008651
2013-05-16 07:18 pieper Status acknowledged => resolved
2013-05-16 07:18 pieper Fixed in Version => Slicer 4.3.0
2013-05-16 07:18 pieper Resolution open => fixed
2013-05-29 08:03 inorton Note Added: 0008683
2013-05-29 08:03 inorton Status resolved => closed
2013-07-09 14:05 finetjul Note Added: 0008973
2013-07-09 14:05 finetjul Status closed => assigned
2013-07-09 14:06 finetjul Severity minor => major
2013-07-09 15:00 pieper Note Added: 0008974
2013-07-09 15:01 pieper Note Added: 0008975
2013-07-09 15:01 pieper Status assigned => resolved
2013-07-09 15:20 finetjul Note Added: 0008976
2013-07-09 15:20 finetjul Status resolved => assigned
2013-07-09 15:40 pieper Note Added: 0008977
2013-07-10 04:17 finetjul Note Added: 0008978
2013-07-10 04:24 finetjul Note Edited: 0008978
2013-07-10 05:16 pieper Note Added: 0008979
2013-07-11 13:32 pieper Relationship added related to 0003125
2013-07-13 00:41 jcfr Note Added: 0009040
2013-07-13 00:42 jcfr Note Added: 0009041
2013-07-13 00:44 jcfr Note Edited: 0009041
2013-07-19 12:04 pieper Note Added: 0009149
2013-08-06 05:44 pieper Note Added: 0009389
2013-08-06 05:44 pieper Status assigned => resolved
2013-08-06 06:37 finetjul Note Added: 0009392
2013-08-06 09:26 pieper Note Added: 0009408
2013-08-06 14:34 pieper Relationship added related to 0003019
2013-08-28 12:24 inorton Note Added: 0009671
2014-03-06 05:22 jcfr Note Added: 0011175
2014-03-06 05:22 inorton Status resolved => closed
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file 2c0985ad
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file ce6c1b88
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file 2748442a
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file ccdfdd31
2018-05-30 01:59 lassoan Relationship added related to 0003890