Exemplo n.º 1
0
        # 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))))

            t = cut.targets_normalized()
            tmp = []
            for t_ in t:
                for t__ in t_:
                    tmp.append(t__)
            targets[i + j * numImages] = tmp