Opened 2 years ago

Closed 23 months ago

#9321 closed enhancement (fixed)

DICOM: restore_snapshot for {Volume,VolumeImage} returned None

Reported by: Zach Pearson Owned by: Zach Pearson
Priority: moderate Milestone:
Component: DICOM Version:
Keywords: Cc: chimerax-programmers
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The DICOM bundle never actually returns grids to ChimeraX's various open functions, only the empty list.

To create the Patient, Study, Series hierarchy, the DICOM bundle opens a patient as an empty model, then opens a Study as an empty child model, then the study opens its various series as child models.

Studies call self.add(s.to_models()) for all Series (s) they own, and Series.to_models() calls DicomData.to_models() which finally returns either grids or DicomContours.

If there's a way to preserve this hierarchy with the map data restore code I can change my code to adhere to it, or possibly we should have a way to let bundles that do these kinds of screwy things with the model hierarchy return the empty list without the warning.

Change History (2)

comment:1 by Eric Pettersen, 2 years ago

So to summarize the discussion you, Tom, and I had:

(1) A class needs to restore and return an instance of itself based on the saved state data it is given. If it's a Model subclass, besides restoring its own specific state it needs to call Model.set_state_from_snapshot(inst, session, generic-model-data) where generic-model-data was saved from Model.take_snapshot(self, session, flags) during the class's take_snapshot().

(2) A class really only needs to save and restore its own attributes. If those attributes are themselves classes, the session code will recursively save/restore those classes.

comment:2 by Zach Pearson, 23 months ago

Resolution: fixed
Status: assignedclosed

I've changed the way DICOMs get restored to follow ChimeraX's convention.

Note: See TracTickets for help on using tickets.