MISProjectJSON
- class misalign.model.project.MISProjectJSON(images: list[MISImage] | None = None, relations: list[MISRelation] | None = None, calibration: dict[str, Any] | None = None, file_path: Path | str | None = None, **mis_data)
MISProject for JSON.
- __init__(images: list[MISImage] | None = None, relations: list[MISRelation] | None = None, calibration: dict[str, Any] | None = None, file_path: Path | str | None = None, **mis_data) None
Initialize MISProject.
- Parameters:
- imageslist[MISImage] | None
list of MISImage or None by default.
- relationslist[MISRelation] | None
list of MISRelation or None by default.
- calibrationdict[str,Any] | None
calibration dictionary of form {“pixel”:number,”length”:number,”length_unit”:str} or None by default.
- file_pathPath | str | None
Path or path-like string to .mis file or None by default.
- **mis_datakwargs
Any other passed kwargs will be kept in self._dict and should be JSON dump-able objects.
Methods
__init__([images, relations, calibration, ...])Initialize MISProject.
add_relation(relation)Append a relation to the list of relations and get its index.
build([mis_filepath, image_filepaths, ...])Build a MISProjectJSON.
find_image_paths(mis_filepath[, update])Find and optionally update all image paths.
find_relations(image_name)Find all relations which include a specific image.
for_json()Returns a dictionary compatible with JSON.dump().
get_calibration()Get the calibration.
get_image(image_name)Get the image for an image name.
get_image_names()Get the list of image names.
get_project_path()Get path for project save file.
get_relations()Get the list of MISRelation.
index_relation(relation)Get the index of a relation.
load(mis_filepath)Load a MISProjectJSON from .mis.json file.
remove_image(image_name)Remove an image from the list of images by image name.
remove_relation(relation)Remove a relation from the list of relations.
rename_image_relations(old_image_name, ...)Rename an image in all relations.
save(mis_filepath)Save the MISProjectJSON to a .mis.json file.
set_calibration(calibration)Set the calibration.
set_image(image_name, image)Get the image for an image name.
set_images(images)Set the list of MISImage.
set_project_path(mis_filepath)Set the path for project save file.
set_relation(relation_index, relation)Replace an existing relation based on its index in the list of relations.
set_relations(relations)Set the list of MISRelation.
Attributes
data- classmethod build(mis_filepath: Path | str | None = None, image_filepaths: list[Path | str] | None = None, calibration_filepath: Path | str | None = None, **kwargs) MISProjectJSON
Build a MISProjectJSON.
- Parameters:
- mis_filepathPath | str | None
Path or path-like string for .mis.json file or None by default.
- image_filepathslist[Path | str] | None
List of Path or path-like strings or None by default.
- calibration_filepathPath | str | None
Path or path-like string for .miscal.json file or None by default.
- **kwargs
Any other passed kwargs will be kept in self._dict and should be JSON dump-able objects.
- Returns:
- new_projectMISProjectJSON
MISProjectJSON initialized from the provided parameters.
Notes
This method does not create a file, that must be done with the save method.
- classmethod load(mis_filepath) MISProjectJSON
Load a MISProjectJSON from .mis.json file.
- Parameters:
- mis_filepathPath | str
Path or path-like string to .mis.json file.
- Returns:
- loaded_projectMISProjectJSON
MISProjectJSON initialized from the data in the .mis.json file.
- save(mis_filepath) None
Save the MISProjectJSON to a .mis.json file.
- Parameters:
- mis_filepathPath | str
Path or path-like string to .mis.json file.