Exemplo n.º 1
0
        #save image path and robot head position
        trackedJsonPath = f'tracked{index:08d}.JSON'
        parameterJsonPath = f'parameter{index:08d}.JSON'
        # FIXME prefix can be "drr" or "xray"
        prefix = 'drr'
        imagePath = f'{prefix}{index:08d}.dcm'

        # load parameter-json file
        # with open(parameter_dir + parameterJsonPath) as parameter_file:
        #    json_data = json.load(parameter_file)
        #    x.append(json_data['Position']['X'])
        #    y.append(json_data['Position']['Y'])
        #    z.append(json_data['Position']['Z'])

        # load json and image file
        cut.load(dicom_file=imagePath, tracked_file=trackedJsonPath)

        # we add noise to the original position of the data
        for j in range(numCuts):
            # rotate image with normally distributed angle with sigma = 10 degrees
            normalDistAngle = np.random.normal(0, config['angleStddev'])
            cut.rotate(normalDistAngle)

            # generate random image center point in range -12 - + 12 from the current ceiled center point
            randomRadius = random.uniform(0, config['displacement'])
            randomPhi = random.uniform(0, 360)  # in degrees

            images[i + j * numImages] = cut.cut_to(
                (randomRadius * math.cos(math.radians(randomPhi)),
                 randomRadius * math.sin(math.radians(randomPhi))))