Model vtk file name problem in Slicer 4.7 and 4.9

Hi!
I have found some error in 3D Slicer V4.7 and V4.9
In MRML file making after updating some scenes,
they make vtk file name incorrectly.
As like

So error message occured in Python console.
ReadDataInternal: model file ‘D:/3D…/3DVisualizationData/3DVisualizationData/3DHeadData/hemispheric_white_matter.vtk.vtk’ not found.

==> No 3D Scene and only 2D scene displayed in 3D panel.
So update .vtk.vtk to .vtk with text editor.
perpectly screen maked with updated 3D scene.

I used sample 3DheadScene.mrml file in your tutorial site.
(https://www.slicer.org/wiki/Documentation/4.8/Training)

my PC environment : Windows 10 recently version, HP notebook with AMD A10 processor and 8GB memory.

I cannot reproduce this. Could you describe what exact steps do you do after loading the scene? Only use Slicer 4.8 (latest stable) or 4.9 (latest nightly).

** Sorry, in previous messgae, vanished tag statements **

There are no specific scene editing.
When saving to a new file for new edition,
(ex: mynew.mrml) in that file,
updated vtk file name incorrectly.
As like (XML tag) below,
ModelStorage
id=“vtkMRMLModelStorageNode1” name=“vtkMRMLModelStorageNode1” hideFromEditors=“true” selectable=“true” selected=“false” attributes=“Category:” fileName=“hemispheric_white_matter.vtk.vtk” useCompression=“1” defaultWriteFileExtension=“vtk” readState=“0” writeState=“0” coordinateSystem=“RAS”

It is file name construction problem in XML tag of mrml file,

I recall trying to fix this problem on saving scenes, with this commit:

https://github.com/Slicer/Slicer/commit/c44f73b3e79f1ef10b876a963bcd472e488145f4#diff-38c329d977c74c8714c51bd6c0401b0c

vtkMRMLStorageNode::GetSupportedFileExtension just returns the last extension in a doubled one, and the storage node call GetFileNameWithoutExtension only removes the last one:
(load cube.vtk from Slicer/Libs/MRML/Core/Testing/TestData/cube.vtk)

snode.SetFileName(‘C:/Slicer_src/Slicer/Libs/MRML/Core/Testing/TestData/cube.vtk.vtk’)
snode.GetFileNameWithoutExtension()
‘cube.vtk’

So where there’s code that’s just using GetFileNameWithoutExtension and adding an extension:
Libs/MRML/Logic/vtkMRMLApplicationLogic.cxx: uniqueFileName = storageNode->GetFileNameWithoutExtension(fileBaseName.c_str()) + defaultWriteExtension;

that’s going to result in the doubled extension again.

More checks could be added in the save data dialog to ensure that safeNodeName doesn’t have a file extension or that it doesn’t get doubled.

There have been further fixes to this since then and it should work correctly now. Exactly one extension is removed and added to the node name or previous file name, so there should be no duplication.

I could not reproduce duplication with 4.8, no matter how or how many times I saved the scene.

Could you provide step-by-step instructions (describe each click) or screen capture video?

During editing on V4.7 and V4.9 using sample file, 3DHeadScene.mrml.
(https://www.slicer.org/wiki/Documentation/4.8/Training)
Not edit vtk files in directory 3DHeadData.

My editing work is based training manual
3DDataLoadingandVisualization_Slicer4.5_SoniaPujol.pdf.

There are no special working.
Load data 3DHeadScene.mrml.
Work editing following training manual.
(Part2: 3D visualization of surface models of the brain)
And as Part3, save to new mrml file only.
No more other work, only tutorial.

But double extention name (.vtk.vtk) occured in saving.
So I edit .vtk.vtk to .vtk directly from new mrml file.
And no problem and no error message on python console.

this is 2nd test.

  • load 3DHeadScene.mrml

  • rotate face on 3D View

  • select Models module

  • select Skin.vtk on Scene tab

  • Opacity to 0.4

  • save to new.mrml file

  • Close scene

  • load new.mrml file

  • vanised face on 3D View

  • shutdown 3D Slicer and run

  • so, .vtk.vtk to .vtk with text editor

  • load new.mrml file

  • no problem

  • but other python console message below


already has observer
already has observer
already has observer
Warning: In C:\D\N\Slicer-0\Libs\MRML\Core\vtkMRMLDisplayNode.cxx, line 523
vtkMRMLModelDisplayNode (0000019278701260): Invalid activeAttributeLocation:

Loaded volume from file: F:/3D Slicer/Slicer4Sample/3DVisualizationData/3DVisualizationData/3DHeadData/grayscale.nrrd. Dimensions: 256x256x159. Number of components: 1. Pixel type: short.

ReadDataInternal: file does not exist: F:/3D Slicer/Slicer4Sample/3DVisualizationData/3DVisualizationData/3DHeadData/Axial.png

ReadDataInternal: file does not exist: F:/3D Slicer/Slicer4Sample/3DVisualizationData/3DVisualizationData/3DHeadData/Sagittal .png

ReadDataInternal: file does not exist: F:/3D Slicer/Slicer4Sample/3DVisualizationData/3DVisualizationData/3DHeadData/Coronal .png

( …png file not found problem)

==> white space on file name as like Sagittal .png, Coronal.png.
(20% space exist in xml file new.mrml,
SceneViewStorage
id=“vtkMRMLSceneViewStorageNode4” name=“vtkMRMLSceneViewStorageNode4” hideFromEditors=“true” selectable=“true” selected=“false” fileName=“Sagittal20%.png” useCompression=“1” defaultWriteFileExtension=“png” readState=“4” writeState=“4”
)
but “Axial.png” is correct.

  • png files not exist on distribution zip file
  • this png files make from saving??

Thank you, I was able to reproduce the problems using Slicer 4.8. The main issue is that this scene was created with a much older version of Slicer and it had some inconsistencies (such as node name ending with “.vtk”) and some files were missing (thumbnail for scene views).

I’ve fixed these issues (see resulting scene), and updated links to the data set in 4.8 and nightly training pages.

1 Like