Skip to content

Implementation of Hough Transform for auto rotation of xray images

Notifications You must be signed in to change notification settings

ronocara/HoughTransform_xray

Repository files navigation

HoughTransform_xray

Following steps done in order:

  1. remove the outliers listed in the anomalies folder
  2. get rectangle mask
  3. use HoughLines now to get lines of the rectangle
    3.a get contours of the rectangle
    3.b if no rectangle detected , keep it as is
    3.c get the longest line detected
    3.d get the angle of the longest line
  4. Rotation of the rectangle
    the rectangle mask will be used for segmentation, anything outside the rectangle is considered background
    4.a If there is no rectangle detected. will keep image as is 4.b if the rectangle is horizontal, rotate 90 degrees
    4.c if rectangle is already upright no need for rotation matrix
    4.d if not upright or horizontal, get rotation matrix and compute for proper upright position
    4.e check if height is longer than width, if not interchange the width with the height
  5. centering of image
    5.a if there is no mask /rectangle detected, will not center
    5.b if there's a rectangle center image based on the rectangle position

To run do, the following:

  1. make 3 folders :
    • output_0, output_1, output_3
    • this is because there is iteration. the output_0 will be used as input for the second run and so on.
  2. Use houghT.ipynb to run
    • folder_path = MURA humerus images
    • txt_path = to_invert.txt path (list images that needs to be inverted)
    • output_paths = paths of the output folders


segmentation, rotation, and centering process



results on different images

Issues encoutered



Still having issues with centering images. It does not work on all the images



There are also instances where the humerus inside the rectangle is not upright. Only the rectangle has the correct upright position and not the humerus

About

Implementation of Hough Transform for auto rotation of xray images

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published