You can add a custom reader for any file format using a short Python script. See example here:
That said, pickling is intended for temporary storage, not for archival or sharing. So, loading pickled data via “Add data” does not sound like a good idea. Using any of the standard file formats, and maybe using a simple human-readable container file format, such as json for custom metadata would be more appropriate.
Can you tell a bit more about your use case? What generates the pickled data? What kind of data you pickle? Have you considered using a standard file format instead (nrrd for images, ply for meshes, etc)?
Just a follow-up regarding the custom reader - do I add this class to the same file where all my custom extension code is?
A colleague of mine creates landmarks in US and MR images in his custom software, and from there he saves the landmarks. The landmarks are stored in a numpy array which he then pickles.
I understand that pickles are not created for such a use case, but I’m not sure I’ll be able to change his mind to adapt his workflow.
Saving the data in json should be almost as simple as pickling and would have many advantages (I don’t even want to get started on that). You could even use Slicer’s markup json file format and then you would not need an importer at all, you could just drag-and-drop the files into Slicer to load them and could directly save them from Slicer.
Yes, you put the MyModuleFileReader and MyModuleFileWriter classes into any scripted module in your extension and Slicer automatically discovers them when the module is loaded. MyModule is the name of the main module class.