Adding models to catalogued volumes
A file representing a model created on a catalogued tomogram will be stored in a predefined position. For instance, a model named someModel created by Dynamo in one of its catalogue-based tomogram viewers for the volume indexed as 2 in a catalogue named myCatalogue will be automatically stored in the position:
Entering a model file into a catalogue
Now, if you have produced a model object myModel independently from the catalogue system, and want to embed it and assign it to a catalogued tomogram, you might have the temptation of just saving it as
While this will work for many functionalities, this is not totally correct, as the catalogue needs to preserve some internal links.
- Assign the model with the dcm command dcm
- dcm -c myCatalogue -i 2 -am myModel.omd
- for a models contained in a file myModel.omd, or
- dcm('-c', 'myCatalogue', '-i', 2 ,'-am', m);
- if the model is contained in an workspace object m
- Alternatively, you can tell the catalogue to relink all the files found in the models folder of one or more volumes.
- dcm -c myCatalogue --relinkAllModelFiles
- warning: this feature is not yet fully implemented.
Direct assignment of model object
Sometimes you want with work with model objects inside the Matlab/Standalone workspace, in order to create and manipulate them directly. In such cases, you can first link a model with a catalogued volume (with method linkCatalogue) and then save it into the catalogue (with method linkCataloguedVolume).
For instance, with the following excerpt of code you can define a vesicle model and link it into the volume with index '1' inside the catalogue 'myCatalogue'
v = dmodels.vesicle(); v.center = [100,100,150]; v.radius = 50; v.name = 'myManualVesicle'; v.linkCatalogue('myCatalogue','i',1); v.saveInCatalogue();
Note that a model is not directly linked to a catalogue. You need to specify to which tomogram in the catalogue it is linked. Also, linking to the catalogued tomogram by itself will not save the object in disk. You need to invoked afterwards the method saveInCatalogue, or to use the flag 'save','s' inside linkCatalogue with value 1, i.e.
The link between a model and its 'volume' entry happens over the property cvolume in the model object. If you want to imitate manually the action of the flag am, you just need to extract the corresponding 'cvolume' object of the catalogue and assign it to the 'cvolume' property of the model before saving it.
When working inside a catalogue and accessing a model file from a volume, Dynamo will normally relink the model so that it points to the calling volume. For such operations, the above described protocol is not necessary.