# Not able to load Freesurfer Model (lh.pial) on Slicer 5.8.1

**URL:** <https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761>\
**Category:** Development\
**Tags:** freesurfer\
**Created:** [July 17, 2025, 6:35pm UTC](https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761 "2025-07-17T18:35:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![justomont](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/justomont/32/16814_2.png) [@justomont](https://discourse.slicer.org/u/justomont)\
**Post date:** [July 17, 2025, 6:35pm UTC](https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761/1 "2025-07-17T18:35:01Z")

</div>

I’m trying to load a FreeSurfer model (lh.pial) programmatically through a scripted module but I’m not achieving it.

I’ve tried:

```auto
fsImporterLogic = slicer.util.getModuleLogic('FreeSurferImporter')
volumeNode = fsImporterLogic.LoadFreeSurferVolume(file_path)

```

where file\_path is the path to one of the files I want to open, and got the following error:

```auto
vtkITKArchetypeImageSeriesReader::ExecuteInformation: Cannot open /Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial. ITK exception info: error in unknown: Could not create IO object for reading file /Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial
[VTK] Tried to create one of the following:
[VTK] BMPImageIO
[VTK] BioRadImageIO
[VTK] DCMTKImageIO
[VTK] GDCMImageIO
[VTK] GiplImageIO
[VTK] JPEGImageIO
[VTK] LSMImageIO
[VTK] MGHImageIO
[VTK] MINCImageIO
[VTK] MRCImageIO
[VTK] MetaImageIO
[VTK] NiftiImageIO
[VTK] NrrdImageIO
[VTK] PNGImageIO
[VTK] ScancoImageIO
[VTK] StimulateImageIO
[VTK] TIFFImageIO
[VTK] VTKImageIO
[VTK] MRMLIDImageIO
[VTK] You probably failed to set a file suffix, or
[VTK] set the suffix to an unsupported type.
[VTK] Algorithm vtkITKArchetypeImageSeriesScalarReader (0x7f8fc479ae80) returned failure for request: vtkInformation (0x60001155aa00)
[VTK] Debug: Off
[VTK] Modified Time: 5320081
[VTK] Reference Count: 1
[VTK] Registered Events: (none)
[VTK] Request: REQUEST_INFORMATION
[VTK] ALGORITHM_AFTER_FORWARD: 1
[VTK] FORWARD_DIRECTION: 0
[VTK] vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Reading of file '/Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial' 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 '/Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial' (first filename: '')
[VTK] vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Reading of file '/Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial' 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 '/Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial' (first filename: '')
[VTK] vtkMRMLVolumeArchetypeStorageNode::ReadDataInternal: Cannot read '/Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial' file as a volume of type 'Volume'. Details: FileFormatError.
[VTK] vtkMRMLStorageNode::ReadData: Failed to read node lh (vtkMRMLScalarVolumeNode5) from filename='/Users/justo/Library/CloudStorage/GoogleDrive-justo.montoya@upf.edu/Mi unidad/SLICER/test_raw/fsfolder/surf/lh.pial'

```

I’ve also tried other options like:  
`modelNode = slicer.util.loadModel(file_path)`

But it’s not working either. How can I open this FreeSurfer model programmatically?

Thanks in advance! 🙂

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 18, 2025, 11:35am UTC](https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761/2 "2025-07-18T11:35:56Z")

</div>

The method you tried is for loading images. You can load models (in freesurfer terminology overlays) using `LoadFreeSurferScalarOverlay`.

---

<div class="post-metadata">

**Author:** ![justomont](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/justomont/32/16814_2.png) [@justomont](https://discourse.slicer.org/u/justomont)\
**Post date:** [July 18, 2025, 12:36pm UTC](https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761/3 "2025-07-18T12:36:18Z")

</div>

Thanks.

What is an example usage of `LoadFreeSurferScalarOverlay()`?

I’ve seen that the logic is defined here [SlicerFreeSurfer/FreeSurferImporter/Logic/vtkSlicerFreeSurferImporterLogic.h at master · PerkLab/SlicerFreeSurfer · GitHub](https://github.com/PerkLab/SlicerFreeSurfer/blob/master/FreeSurferImporter/Logic/vtkSlicerFreeSurferImporterLogic.h) but I can’t understand how to apply it to my situation.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [July 18, 2025, 2:43pm UTC](https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761/4 "2025-07-18T14:43:15Z")

</div>

I misspoke above, Slicer models correspond to freesurfer surfaces (\*h.white, \*h.pial, \*h.inflated, \*h.sphere, _h.sphere.reg, h.orig files), and Slicer scalar arrays correspond to freesurfer overlays (.area_, _.curv_, \*.sulc, \*.W files).

Surface reading was reworked about 1-2 years ago to use nibabel and is now implemented in a separate logic. You can use it as it is shown in this test:

> <https://github.com/PerkLab/SlicerFreeSurfer/blob/85980a0bf6558a36985fa57ae1c65e67a268043b/NiBabelModelIO/NiBabelModelIO.py#L261-L288>

`slicer.util.loadNodeFromFile()` would work if the NiBabelModelIO registered itself as a reader plugin. It would be nice if you could implement it (you would add a `NiBabelModelIOFileReader` class to the `NiBabelModelIO.py` and implement a few methods - similarly to [this](https://github.com/Slicer/Slicer/blob/40b45ad844a2148cc19d694f622833e712fff72f/Modules/Scripted/ImportItkSnapLabel/ImportItkSnapLabel.py#L33-L59)). But if you don’t have the time then you can simply use the NiBabelModelIO module logic directly.

---

<div class="post-metadata">

**Author:** ![justomont](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/justomont/32/16814_2.png) [@justomont](https://discourse.slicer.org/u/justomont)\
**Post date:** [July 22, 2025, 9:31am UTC](https://discourse.slicer.org/t/not-able-to-load-freesurfer-model-lh-pial-on-slicer-5-8-1/43761/5 "2025-07-22T09:31:30Z")

</div>

Thank you very much for the clarification!

Regarding the suggestion to implement the `NiBabelModelIOFileReader` class, I’d be genuinely happy to contribute something useful to the community. However, I’m currently in the final stages of my PhD, and unfortunately I won’t be able to commit the necessary time and focus right now.

That said, once my schedule opens up a bit post-dissertation, I’d be glad to revisit this and potentially work on the implementation. I’ll keep your suggestion in mind and reach out when I have the bandwidth to properly contribute.

Thanks again for your support and for all the work you do on Slicer!!
