예제 #1
0
    for i in DarkNames
]

print 'Correcting images with darks'
CorrectedImages = [i - k for i, k in zip(Radiography, Dark)]

print 'Crop zoomed region'
ZoomedImages = [i[445:775, 510:615] for i in CorrectedImages]

print 'Get line profiles in zoomed region'
CoordinatesLeadPhantom = [(30, 310), (35, 10)]
# The lineprofiler gives back a tuple with coordinates and line profile based
# on these cordinates. To plot the profile, we can access it with
# LineProfile[i][1].
LineProfileLeadPhantom = [
    lineprofiler.lineprofile(i, CoordinatesLeadPhantom) for i in ZoomedImages
]

print 'Get min, mean, max and STD for each set of images (original, corrected' \
      ' and zoomed).'

MinImage = [numpy.min(i) for i in Radiography]
MeanImage = [numpy.mean(i) for i in Radiography]
MaxImage = [numpy.max(i) for i in Radiography]
STDImage = [numpy.std(i) for i in Radiography]

MinCorrected = [numpy.min(i) for i in CorrectedImages]
MeanCorrected = [numpy.mean(i) for i in CorrectedImages]
MaxCorrected = [numpy.max(i) for i in CorrectedImages]
STDCorrected = [numpy.std(i) for i in CorrectedImages]
예제 #2
0
    plt.subplot(243)
    my_display_image(CorrectedData[counter])
    plt.title("Image - Dark")

    plt.subplot(244)
    my_display_histogram(CorrectedData[counter])

    # Select two line profiles on corrected image.
    # The two profiles are along the first two lines of the resolution phantom
    Coordinates = [((566, 350), (543, 776)), ((726, 350), (703, 776))]
    MyColors = ["#D1B9D4", "#D1D171", "#84DEBD"]

    for ProfileCounter, CurrentCoordinates in enumerate(Coordinates):
        SelectedPoints, LineProfile = lineprofiler.lineprofile(
            CorrectedData[counter], CurrentCoordinates, showimage=False
        )

        # Draw selection on corrected image
        plt.figure(counter + 1, figsize=(16, 9))
        plt.subplot(243)
        my_display_image(CorrectedData[counter])
        plt.plot(
            (SelectedPoints[0][0], SelectedPoints[1][0]),
            (SelectedPoints[0][1], SelectedPoints[1][1]),
            color=MyColors[ProfileCounter],
            marker="o",
        )
        plt.plot(SelectedPoints[0][0], SelectedPoints[0][1], color="yellow", marker="o")
        plt.plot(SelectedPoints[1][0], SelectedPoints[1][1], color="black", marker="o")
        plt.title("Image - Dark")
예제 #3
0
 plt.xlabel('Voltage [kV]')
 plt.ylabel('Current [uA]')
 plt.xlim([20, 70])
 plt.ylim([0, 75])
 # Show the current image
 plt.subplot(422)
 plt.cla()
 plt.title('Contrast stretched Image %s/%s: %s\nWith line profiles '
           'and red region used for mean and STD' % (
               ImageCounter + 1, len(ImageList),
               os.path.basename(ImageName)))
 Img = read_raw(ImageName)
 plt.imshow(contrast_stretch(Img))
 # Show where line profiles have been calculated
 for CoordinateCounter, CurrentCoordinates in enumerate(Coordinates):
     SelectedPoints, LineProfile = lineprofiler.lineprofile(
         Img, CurrentCoordinates, showimage=False)
     plt.plot((SelectedPoints[0][0], SelectedPoints[1][0]),
              (SelectedPoints[0][1], SelectedPoints[1][1]),
              color=UserColors[CoordinateCounter], marker='o')
     plt.plot(SelectedPoints[0][0], SelectedPoints[0][1],
              color='yellow', marker='o', alpha=0.618)
     plt.plot(SelectedPoints[1][0], SelectedPoints[1][1],
              color='black', marker='o', alpha=0.618)
 plt.axis('off')
 # Crop region for Standard deviation
 CropSize = 900
 CropStart = [50, 700]
 Crop = Img[CropStart[0]:CropStart[0] + CropSize,
            CropStart[1]:CropStart[1] + CropSize]
 # Draw crop region in original image
 currentAxis = plt.gca()
예제 #4
0
    plt.title('')

    plt.subplot(243)
    my_display_image(CorrectedData[counter])
    plt.title('Image - Dark')

    plt.subplot(244)
    my_display_histogram(CorrectedData[counter])

    # Select two line profiles on corrected image.
    # The two profiles are along the first two lines of the resolution phantom
    Coordinates = [((566, 350), (543, 776)), ((726, 350), (703, 776))]
    MyColors = ["#D1B9D4", "#D1D171", "#84DEBD"]

    for ProfileCounter, CurrentCoordinates in enumerate(Coordinates):
        SelectedPoints, LineProfile = lineprofiler.lineprofile(
            CorrectedData[counter], CurrentCoordinates, showimage=False)

        # Draw selection on corrected image
        plt.figure(counter + 1, figsize=(16, 9))
        plt.subplot(243)
        my_display_image(CorrectedData[counter])
        plt.plot((SelectedPoints[0][0], SelectedPoints[1][0]),
                 (SelectedPoints[0][1], SelectedPoints[1][1]),
                 color=MyColors[ProfileCounter],
                 marker='o')
        plt.plot(SelectedPoints[0][0],
                 SelectedPoints[0][1],
                 color='yellow',
                 marker='o')
        plt.plot(SelectedPoints[1][0],
                 SelectedPoints[1][1],
예제 #5
0
               for i in RadiographyNames]
Dark = [numpy.fromfile(i, dtype=numpy.int16).reshape(CameraHeight, CameraWidth)
        for i in DarkNames]

print 'Correcting images with darks'
CorrectedImages = [i - k for i, k in zip(Radiography, Dark)]

print 'Crop zoomed region'
ZoomedImages = [i[445:775, 510:615] for i in CorrectedImages]

print 'Get line profiles in zoomed region'
CoordinatesLeadPhantom = [(30, 310), (35, 10)]
# The lineprofiler gives back a tuple with coordinates and line profile based
# on these cordinates. To plot the profile, we can access it with
# LineProfile[i][1].
LineProfileLeadPhantom = [lineprofiler.lineprofile(i, CoordinatesLeadPhantom)
                          for i in ZoomedImages]

print 'Get min, mean, max and STD for each set of images (original, corrected' \
      ' and zoomed).'

MinImage = [numpy.min(i) for i in Radiography]
MeanImage = [numpy.mean(i) for i in Radiography]
MaxImage = [numpy.max(i) for i in Radiography]
STDImage = [numpy.std(i) for i in Radiography]

MinCorrected = [numpy.min(i) for i in CorrectedImages]
MeanCorrected = [numpy.mean(i) for i in CorrectedImages]
MaxCorrected = [numpy.max(i) for i in CorrectedImages]
STDCorrected = [numpy.std(i) for i in CorrectedImages]