Package: miqa-python-client
MIQA Python ClientThis simple python library is intended to allow users of a MIQA instance to interact with the MIQA API programmatically and perform tasks they may not be able to accomplish in the web interface.The structure of classes in this library closely imitates the structure of models in MIQA, so it is recommended that a user understands this structure before proceeding to use the python client. The documentation explaining this structure can be found athttps://openimaging.github.io/miqa/projects/.In summary, Projects are the top-level objects that act as organizational buckets for experiments. Experiments are collections of scans that may be related in some way. Scans are collections of related 3D medical images. Each scan must have at least one image, or Frame, associated with it. A scan may have multiple Frames representing time steps or some other fourth dimension to the images collected. The purpose of MIQA is to annotate the quality of scans that are currently categorized as usable, unusable, or otherwise. Thus, a Scan Decision is an object that stores those determinations. A Scan can have zero or more Scan Decisions.UsageExample usages of available functions are shown inexample.py. Reading this example is the best way to understand how functions in this client are used. Below are some further explanations of the usages found in the example.Explanation of classesIn the MIQA python client, the top-level class,MIQA, refers to an instance of MIQA. For a single organization, this is likely the only active instance you will use. This class holds information for connecting to the API.EachMIQAobject will hold a collection ofProjectobjects, which will each hold a collection ofExperimentobjects, which will each hold a collection ofScanobjects, which will each hold collections of bothFrameobjects andScanDecisionobjects.The following table displays the available attributes and functions on these classes. Attributes are exactly as they are returned by the API.Class NameAttributesFunctionsMIQAurl, headers, token, version, projects, artifact_optionslogin, get_config, get_all_objects, get_project_by_id, create_project, print_all_objectsProjectid, name, creator, experiments, total_scans, total_complete, MIQAget_experiment_by_id, add_experiment, print_all_objects, deleteExperimentid, name, scans, project, noteget_scan_by_id, add_scan, update_note, print_all_objectsScanid, name, experiment, decisions, frames, scan_type, subject_id, session_id, scan_linkadd_frames_from_paths, add_decision, print_all_objectsFrameid, frame_number, frame_evaluation, extension, download_urlScanDecisionid, decision, creator, created, note, user_identified_artifacts, locationExplanation of functionsEach level in the object hierarchy can be accessed from the level above it.Projects can be accessed withMIQA.projects,MIQA.get_project_from_id(id), orMIQA.create_project(name).Experiments can be accessed withProject.experiments,Project.get_experiment_by_id(id), orProject.add_experiment(name).Scans can be accessed withExperiment.scans,Experiment.get_scan_by_id(id), orExperiment.add_scan(name, scan_type, [subject_id, session_id, scan_link]).Frames can be accessed withScan.framesorScan.add_frames_from_paths(paths).Scan Decisions can be accessed withScan.decisionsorScan.add_decision(decision, note, [present_artifacts, absent_artifacts])print_all_objects: Classes which store more objects (i.e. notFramenorScanDecision) have a function which recursively prints all objects below the target object. This is for the convenience of the user to see stored objects quickly. For example, callingprint_all_objectson a MIQA object will result in something similar to the following printout:MIQA Instance http://localhost:8000/api/v1
 Project Guys
   Experiment IXI002
     Scan 0828-DTI
     |Decisions:   []
     |Frames:   [Frame 0, Frame 1, Frame 2, Frame 3, Frame 4, Frame 5, Frame 6, Frame 7, Frame 8, Frame 9, Frame 10, Frame 11, Frame 12, Frame 13, Frame 14, Frame 15, Frame 16]
     Scan 0828-MRA
     |Decisions:   []
     |Frames:   [Frame 0]
     Scan 0828-PD
     |Decisions:   []
     |Frames:   [Frame 0]
     Scan 0828-T1
     |Decisions:   []
     |Frames:   [Frame 0]
     Scan 0828-T2
     |Decisions:   []
     |Frames:   [Frame 0]
   Experiment IXI016
     Scan 0697-MRA
     |Decisions:   []
     |Frames:   [Frame 0]
     Scan 0697-PD
     |Decisions:   []
     |Frames:   [Frame 0]
     Scan 0697-T1
     |Decisions:   []
     |Frames:   [Frame 0]
     Scan 0697-T2
     |Decisions:   []
     |Frames:   [Frame 0]Whereas callingprint_all_objectson a Scan object will produce a much shorter printout:Scan 0697-T2
 |Decisions:   []
 |Frames:   [Frame 0]