retuve.defaults.config

Default Configs for Each Subconfig in the Keyphrases Module.

  1# Copyright 2024 Adam McArthur
  2#
  3# Licensed under the Apache License, Version 2.0 (the "License");
  4# you may not use this file except in compliance with the License.
  5# You may obtain a copy of the License at
  6#
  7#     http://www.apache.org/licenses/LICENSE-2.0
  8#
  9# Unless required by applicable law or agreed to in writing, software
 10# distributed under the License is distributed on an "AS IS" BASIS,
 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12# See the License for the specific language governing permissions and
 13# limitations under the License.
 14
 15"""
 16Default Configs for Each Subconfig in the Keyphrases Module.
 17"""
 18
 19import torch
 20from radstract.data.dicom import DicomTypes
 21
 22from retuve.keyphrases.config import Config
 23from retuve.keyphrases.enums import (
 24    ACASplit,
 25    Colors,
 26    CRFem,
 27    Curvature,
 28    GrafSelectionMethod,
 29    MetricUS,
 30    MidLineMove,
 31    OperationType,
 32)
 33from retuve.keyphrases.subconfig import (
 34    APIConfig,
 35    BatchConfig,
 36    HipConfig,
 37    TrakConfig,
 38    VisualsConfig,
 39)
 40
 41RETUVE_DIR = "./retuve-data"
 42
 43visuals = VisualsConfig(
 44    font_h1=None,
 45    font_h2=None,
 46    default_font_size=12,
 47    seg_color=Colors(Colors.PURPLE),
 48    seg_alpha=0.4,
 49    bounding_box_color=Colors(Colors.BLUE),
 50    bounding_box_thickness=2,
 51    text_color=Colors(Colors.WHITE),
 52    background_text_color=Colors(Colors.BLUE),
 53    points_color=Colors(Colors.LIGHT_BLUE),
 54    points_radius=6,
 55    hip_color=Colors(Colors.BLUE),
 56    line_color=Colors(Colors.WHITE),
 57    graf_color=Colors(Colors.GOLD),
 58    line_thickness=3,
 59    display_full_metric_names=False,
 60    display_boxes=False,
 61    display_segs=False,
 62    min_vid_length=6,
 63    min_vid_fps=30,
 64)
 65
 66hip = HipConfig(
 67    midline_color=Colors(Colors.WHITE),
 68    aca_split=ACASplit.GRAFS,
 69    cr_fem_pos=CRFem.CENTER,
 70    fem_extention=0.1,
 71    midline_move_method=MidLineMove.BASIC,
 72    curvature_method=Curvature.RADIST,
 73    measurements=[
 74        MetricUS.ALPHA,
 75        MetricUS.COVERAGE,
 76        # MetricUS.CURVATURE,
 77        # MetricUS.CENTERING_RATIO,
 78        # MetricUS.ACA,
 79    ],
 80    z_gap=2.5,
 81    display_frame_no=True,
 82    display_side=False,
 83    draw_midline=False,
 84    display_fem_guess=False,
 85    draw_side_metainfo=False,
 86    allow_flipping=False,
 87    display_bad_frame_reasons=False,
 88    graf_selection_method=GrafSelectionMethod.MANUAL_FEATURES,
 89    graf_selection_func=None,
 90    graf_selection_func_args={},
 91    display_graf_conf=False,
 92    graf_algo_threshold=None,
 93)
 94
 95trak = TrakConfig(
 96    datasets=[
 97        f"{RETUVE_DIR}/default/uploaded",
 98    ],
 99)
100
101api = APIConfig(
102    savedir=f"{RETUVE_DIR}/default/savedir",
103    url="http://localhost:8000",
104    db_path=f"{RETUVE_DIR}/default/trak.db",
105    upload_dir=f"{RETUVE_DIR}/default/uploaded",
106    hippa_logging_file="hippa.log",
107    api_token=None,
108    origins=["http://localhost:8000"],
109    zero_trust=True,
110    zero_trust_interval=300,
111    orthanc_url="http://localhost:8042",
112    orthanc_username="orthanc",
113    orthanc_password="orthanc",
114)
115
116batch = BatchConfig(
117    mode_func=None,
118    hip_mode=None,
119    mode_func_args={},
120    processes=1,
121    input_types=[".dcm", ".jpg"],
122    datasets=[],
123)
124
125base_config = Config(
126    dicom_type=DicomTypes.SERIES,
127    template=True,
128    crop_coordinates=None,
129    min_seg_confidence=0.6,
130    device=torch.device(6 if torch.cuda.is_available() else "cpu"),
131    operation_type=OperationType.SEG,
132    dev=False,
133    replace_old=False,
134    seg_export=False,
135    subconfig_hip=hip,
136    subconfig_trak=trak,
137    subconfig_visuals=visuals,
138    subconfig_api=api,
139    subconfig_batch=batch,
140    test_data_passthrough=False,
141)
RETUVE_DIR = './retuve-data'
base_config = <retuve.keyphrases.config.Config object>