slicerTrame module working example

Hi all (particularly @finetjul, since you’ve been active on this topic),

I’ve been working with 3D Slicer for a few years now. I recently discovered Trame Slicer, and I think it’s a great tool for bringing Slicer to the web.

I’ve been trying to develop a small test tool to explore the basic functionality, but I’m struggling with the code.

I’d like to implement something that allows me to open a DICOM volume, visualize it, and use a few Segment Editor tools. Any advice on how to get started would be greatly appreciated.

Here’s what I’ve done so far:

  1. Downloaded Slicer 5.11.
  2. Installed the Slicer Trame module.
  3. Ran medical_viewer_app.py from the module (I had to avoid using TurboJPEG).

It shows the web interface, but the screen is completely black. The “Open File” button does not work, probably because it’s not intended to work in this example.

How should I continue from here to start loading volumes and using segment editor tools?

Many thanks,

The “Open File” button is supposed to work. What file format are you trying to load ?

Do you see any error listed in the SlicerTrameServer extension log widget ?

I am triying to load a DICOM volume but the file explorer does not allow folder selection so I selected all files in the folder. I also tried to load a nii.gz volume. Trame shows a spinner loading but in the end it never loads, same happens with .nrrd. Also tryied a slicer scene .mrml but didn’t work.

Maybe I am not doing it right.

Log looks like this:

qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added

qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added

Warning: In vtkObject.cxx, line 725
vtkWin32RenderWindowInteractor (00000107F061A470): WindowResizeEvent will not be generated by vtkRenderWindowInteractor after VTK 9.6.
Use ConfigureEvent instead, or observe WindowResizeEvent on the vtkRenderWindow.


Warning: In vtkObject.cxx, line 725
vtkWin32RenderWindowInteractor (00000107F061A930): WindowResizeEvent will not be generated by vtkRenderWindowInteractor after VTK 9.6.
Use ConfigureEvent instead, or observe WindowResizeEvent on the vtkRenderWindow.


Warning: In vtkObject.cxx, line 725
vtkWin32RenderWindowInteractor (00000107F061CA70): WindowResizeEvent will not be generated by vtkRenderWindowInteractor after VTK 9.6.
Use ConfigureEvent instead, or observe WindowResizeEvent on the vtkRenderWindow.



App running at:
- Local:   http://localhost:8888/
- Network: http://127.0.0.1:8888/

Note that for multi-users you need to use and configure a launcher.

SERVER_PORT: 8888

And to prevent your browser from opening, add '--server' to your command line.

WARNING: In C:\D\P\S-0-build\ITK\Modules\IO\ImageBase\include\itkImageSeriesReader.hxx, line 478
ImageSeriesReader (00000107F69E6D60): Non uniform sampling or missing slices detected,  maximum nonuniformity:0.00100315



ERROR: In vtkITKArchetypeImageSeriesReader.cxx, line 503

vtkITKArchetypeDiffusionTensorImageReaderFile (00000107F05EB870): vtkITKArchetypeImageSeriesReader::ExecuteInformation: Cannot open C:/Users/oscar.rodriguez/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml. ITK exception info: error in unknown:  Could not create IO object for reading file C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml
 Tried to create one of the following:
   BMPImageIO
   BioRadImageIO
   DCMTKImageIO
   GDCMImageIO
   GiplImageIO
   JPEGImageIO
   LSMImageIO
   MGHImageIO
   MINCImageIO
   MRCImageIO
   MetaImageIO
   NiftiImageIO
   NrrdImageIO
   PNGImageIO
   ScancoImageIO
   StimulateImageIO
   TIFFImageIO
   VTKImageIO
   MRMLIDImageIO
 You probably failed to set a file suffix, or
   set the suffix to an unsupported type.


ERROR: In vtkExecutive.cxx, line 730
vtkCompositeDataPipeline (00000107F66D3DA0): Algorithm vtkITKArchetypeDiffusionTensorImageReaderFile (00000107F05EB870) returned failure for request: vtkInformation (000001078774F7F0)
 Debug: Off
 Modified Time: 543083
 Reference Count: 1
 Registered Events: (none)
 Request: REQUEST_INFORMATION
 FORWARD_DIRECTION: 0
 ALGORITHM_AFTER_FORWARD: 1



ERROR: In vtkITKArchetypeImageSeriesReader.cxx, line 503
vtkITKArchetypeImageSeriesVectorReaderSeries (00000107F05EB870): vtkITKArchetypeImageSeriesReader::ExecuteInformation: Cannot open C:/Users/oscar.rodriguez/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml. ITK exception info: error in unknown:  Could not create IO object for reading file C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml
 Tried to create one of the following:
   BMPImageIO
   BioRadImageIO
   DCMTKImageIO
   GDCMImageIO
   GiplImageIO
   JPEGImageIO
   LSMImageIO
   MGHImageIO
   MINCImageIO
   MRCImageIO
   MetaImageIO
   NiftiImageIO
   NrrdImageIO
   PNGImageIO
   ScancoImageIO
   StimulateImageIO
   TIFFImageIO
   VTKImageIO
   MRMLIDImageIO
 You probably failed to set a file suffix, or
   set the suffix to an unsupported type.


ERROR: In vtkExecutive.cxx, line 730
vtkCompositeDataPipeline (00000107F2C05D70): Algorithm vtkITKArchetypeImageSeriesVectorReaderSeries (00000107F05EB870) returned failure for request: vtkInformation (0000010787749AC0)
 Debug: Off
 Modified Time: 544677
 Reference Count: 1
 Registered Events: (none)
 Request: REQUEST_INFORMATION
 FORWARD_DIRECTION: 0
 ALGORITHM_AFTER_FORWARD: 1




ERROR: In vtkITKArchetypeImageSeriesReader.cxx, line 503
vtkITKArchetypeImageSeriesScalarReader (00000107F05EB870): vtkITKArchetypeImageSeriesReader::ExecuteInformation: Cannot open C:/Users/oscar.rodriguez/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml. ITK exception info: error in unknown:  Could not create IO object for reading file C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml
 Tried to create one of the following:
   BMPImageIO
   BioRadImageIO
   DCMTKImageIO
   GDCMImageIO
   GiplImageIO
   JPEGImageIO
   LSMImageIO
   MGHImageIO
   MINCImageIO
   MRCImageIO
   MetaImageIO
   NiftiImageIO
   NrrdImageIO
   PNGImageIO
   ScancoImageIO
   StimulateImageIO
   TIFFImageIO
   VTKImageIO
   MRMLIDImageIO
 You probably failed to set a file suffix, or
   set the suffix to an unsupported type.


ERROR: In vtkExecutive.cxx, line 730
vtkCompositeDataPipeline (00000107F2C05E90): Algorithm vtkITKArchetypeImageSeriesScalarReader (00000107F05EB870) returned failure for request: vtkInformation (000001078774A930)
 Debug: Off
 Modified Time: 545570
 Reference Count: 1
 Registered Events: (none)
 Request: REQUEST_INFORMATION
 FORWARD_DIRECTION: 0
 ALGORITHM_AFTER_FORWARD: 1




ERROR: In vtkMRMLNRRDStorageNode.cxx, line 187
vtkMRMLNRRDStorageNode (00000107F7CD5E40): ReadData: This is not a nrrd file

ERROR: In vtkMRMLStorageNode.cxx, line 1239
vtkMRMLNRRDStorageNode (00000107F7CD5E40): vtkMRMLStorageNode::ReadData: Failed to read node 2023-07-05-Scene.mrml (vtkMRMLDiffusionWeightedVolumeNode1) from filename='C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml'

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 421
vtkMRMLVolumeArchetypeStorageNode (00000107F061D8B0): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Reading of file 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' failed: FileFormatError Number of files listed in the node is 0. File reader says it was able to read 0 files. File reader used the archetype file name of 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' (first filename: '')

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 421
vtkMRMLVolumeArchetypeStorageNode (00000107F061D8B0): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Reading of file 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' failed: FileFormatError Number of files listed in the node is 0. File reader says it was able to read 0 files. File reader used the archetype file name of 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' (first filename: '')

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 421
vtkMRMLVolumeArchetypeStorageNode (00000107F061D8B0): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Cannot read 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' file as a volume of type 'DiffusionTensorVolume'. Details: FileFormatError.

ERROR: In vtkMRMLStorageNode.cxx, line 1239
vtkMRMLVolumeArchetypeStorageNode (00000107F061D8B0): vtkMRMLStorageNode::ReadData: Failed to read node 2023-07-05-Scene.mrml (vtkMRMLDiffusionTensorVolumeNode1) from filename='C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml'

ERROR: In vtkMRMLNRRDStorageNode.cxx, line 187
vtkMRMLNRRDStorageNode (00000107F7CD77B0): ReadData: This is not a nrrd file

ERROR: In vtkMRMLStorageNode.cxx, line 1239
vtkMRMLNRRDStorageNode (00000107F7CD77B0): vtkMRMLStorageNode::ReadData: Failed to read node 2023-07-05-Scene.mrml (vtkMRMLVectorVolumeNode1) from filename='C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml'

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 361
vtkMRMLVolumeArchetypeStorageNode (00000107F061D8B0): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Failed to instantiate a file reader

ERROR: In vtkMRMLStorageNode.cxx, line 1239
vtkMRMLVolumeArchetypeStorageNode (00000107F061D8B0): vtkMRMLStorageNode::ReadData: Failed to read node 2023-07-05-Scene.mrml (vtkMRMLVectorVolumeNode2) from filename='C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml'

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 421
vtkMRMLVolumeArchetypeStorageNode (00000107F061F790): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Reading of file 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' failed: FileFormatError Number of files listed in the node is 0. File reader says it was able to read 0 files. File reader used the archetype file name of 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' (first filename: '')

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 421
vtkMRMLVolumeArchetypeStorageNode (00000107F061F790): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Reading of file 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' failed: FileFormatError Number of files listed in the node is 0. File reader says it was able to read 0 files. File reader used the archetype file name of 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' (first filename: '')

ERROR: In vtkMRMLVolumeArchetypeStorageNode.cxx, line 421
vtkMRMLVolumeArchetypeStorageNode (00000107F061F790): vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Cannot read 'C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml' file as a volume of type 'Volume'. Details: FileFormatError.

ERROR: In vtkMRMLStorageNode.cxx, line 1239
vtkMRMLVolumeArchetypeStorageNode (00000107F061F790): vtkMRMLStorageNode::ReadData: Failed to read node 2023-07-05-Scene.mrml (vtkMRMLScalarVolumeNode1) from filename='C:/Users/OSCAR~1.ROD/AppData/Local/Temp/tmp2wayqlfy/2023-07-05-Scene.mrml'


MRML files are not supported by this “Open Volume” button.

Can you show the logs when you try to load a nii.gz file ?

Sure.

Logs before loading any file:

qSlicerMarkupsModulePrivate::addToolBar: no main window is available, toolbar is not added

qSlicerSequencesModulePrivate::addToolBar: no main window is available, toolbar is not added

Warning: In vtkObject.cxx, line 725
vtkWin32RenderWindowInteractor (0000012B31A27190): WindowResizeEvent will not be generated by vtkRenderWindowInteractor after VTK 9.6.
Use ConfigureEvent instead, or observe WindowResizeEvent on the vtkRenderWindow.


Warning: In vtkObject.cxx, line 725
vtkWin32RenderWindowInteractor (0000012B31A28230): WindowResizeEvent will not be generated by vtkRenderWindowInteractor after VTK 9.6.
Use ConfigureEvent instead, or observe WindowResizeEvent on the vtkRenderWindow.


Warning: In vtkObject.cxx, line 725
vtkWin32RenderWindowInteractor (0000012B31A286F0): WindowResizeEvent will not be generated by vtkRenderWindowInteractor after VTK 9.6.
Use ConfigureEvent instead, or observe WindowResizeEvent on the vtkRenderWindow.




App running at:
 - Local:   http://localhost:8888/
 - Network: http://127.0.0.1:8888/

Note that for multi-users you need to use and configure a launcher.
SERVER_PORT: 8888

And to prevent your browser from opening, add '--server' to your command line.

There are no logs after trying to load nii.gz file.

Done after reinstalling everything :slight_smile:

Many thanks

1 Like