How to use the pypx.utils.seriesPath function in pypx

To help you get started, we’ve selected a few pypx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FNNDSC / pypx / pypx / listen.py View on Github external
def processSeries(self, dcm_info, log_file, study_directory):
        # get information of interest
        series_description = self.processDicomField(dcm_info, "SeriesDescription")
        series_date = self.processDicomField(dcm_info, "SeriesDate")
        series_uid = self.processDicomField(dcm_info, "SeriesInstanceUID")
        self.dp.qprint('Processing %s' % series_uid)

        # log it
        log_file.write('        SeriesDescription: ' + series_description + '\n')
        log_file.write('        SeriesDate: ' + series_date + '\n')
        log_file.write('        SeriesInstanceUID: ' + series_uid + '\n')

        # create series directory
        series_directory = pypx.utils.seriesPath(
            study_directory, series_description, series_date, series_uid)
        self.mkdir(series_directory, self.log_error)

        # Save a mapping from this series_uid to the acutal FS location
        # where the file will be written
        str_mapFile     = os.path.join(self.series_mapDir, '%s.json' % series_uid)
        if not os.path.exists(str_mapFile):
            self.mapFile_save( {series_uid : series_directory}, str_mapFile )

        # store information as a configuration
        series_info = configparser.ConfigParser()
        series_info['SERIES'] = {
            'SeriesDescription': series_description,
            'SeriesDate': series_date,
            'SeriesInstanceUID': series_uid,
            'Location': series_directory