def __init__()

in pathology/transformation_pipeline/ingestion_lib/dicom_util/dicom_standard_util.py [0:0]


  def __init__(self, json_dir: Optional[str] = None):
    self._version = None
    self._header_test_result = None
    self._tags_keywords = None

    # Read json data files.
    self._iod_uid = DicomStandardIODUtil._read_json(
        'dicom_iod_class_uid.json', json_dir
    )
    self._iod_to_module_map = DicomStandardIODUtil._read_json(
        'dicom_iod_module_map.json', json_dir
    )
    self._iod_modules = DicomStandardIODUtil._read_json(
        'dicom_iod.json', json_dir
    )
    self._modules = DicomStandardIODUtil._read_json(
        'dicom_modules.json', json_dir
    )
    self._table = DicomStandardIODUtil._read_json(
        'dicom_tables_part_1.json', json_dir
    )
    self._table2 = DicomStandardIODUtil._read_json(
        'dicom_tables_part_2.json', json_dir
    )
    self._table3 = DicomStandardIODUtil._read_json(
        'dicom_tables_part_3.json', json_dir
    )
    self._tags = DicomStandardIODUtil._read_json('dicom_tags.json', json_dir)
    self._iod_functional_group_modules = DicomStandardIODUtil._read_json(
        'dicom_iod_func_groups.json', json_dir
    )

    self._header_test_result = self._check_header_versions()
    if not self._header_test_result:
      raise DICOMSpecMetadataError(
          'Dicom json metadata was generated from '
          ' different versions of the specification. Json '
          'metadata should be regenerated.'
      )
    self._version = self._iod_modules['header']['dicom_standard_version']
    self._iod_modules = self._iod_modules['dicom_iod']
    self._modules = self._modules['dicom_modules']
    self._table = self._table['dicom_tables_part_1']
    self._table2 = self._table2['dicom_tables_part_2']
    self._table3 = self._table3['dicom_tables_part_3']
    self._iod_functional_group_modules = self._iod_functional_group_modules[
        'dicom_iod_func_groups'
    ]

    for key, value in self._table2.items():
      self._table[key] = value
    del self._table2
    for key, value in self._table3.items():
      self._table[key] = value
    del self._table3
    self._iod_uid = self._iod_uid['dicom_iod_class_uid']
    self._tags = self._tags['dicom_tags']