Skip to content

This repo provides many useful functions for DICOM, NIfTI, and PNG files.

License

Notifications You must be signed in to change notification settings

MolloiLab/imageToolBox.jl

Repository files navigation

🌟 Medical Image Processing Tools 🌟

Welcome to the Medical Image Processing Tools repository! This repository provides a collection of tools for processing medical images, specifically DICOM and PNG files, as well as various utility functions.


πŸ“Œ Table of Contents


πŸ”§ Dependencies

  • πŸ“¦ DICOM
  • πŸ“Š Statistics
  • πŸ“„ CSV
  • πŸ“ˆ DataFrames
  • πŸ“… Dates
  • πŸ–Ό Images

πŸ–Ό DICOM Tools

πŸ“– read_dicom(path_to_file::String)

πŸ” Reads a DICOM file.

  • Input:
    • πŸ“‚ path_to_file: Path to the DICOM file.
  • Output:
    • πŸ“„ DICOM data.
    • πŸ†” SID.
    • πŸ”‘ V_P.
    • πŸ–Ό Image.

πŸ“– get_num_of_patches(img::Matrix{Float32}, lbl::Matrix{Float32}, mask::Matrix{Float32}; thd = 0.35, patch_size = 256)

πŸ” Gets the number of patches needed for an image.

  • Input:
    • πŸ–Ό img: The image.
    • 🎯 lbl: The ROI.
    • 🎭 mask: Binary mask representing the breast area.
  • Optional Input:
    • πŸ“ thd: Threshold of percentage of the white area. Default = 0.35.
    • πŸ“ patch_size: Size of each patch. Default = 256.
  • Output:
    • 🚫 Number of without-BAC patches.
    • βœ… Number of with-BAC patches.

πŸ›  Other Tools

πŸ“– save_to_csv(column_names_, data::Matrix, csv_name::String)

πŸ’Ύ Saves data to a local CSV file.

  • Input:
    • πŸ“‹ column_names_: Column names.
    • πŸ“Š data: 2D array of data.
    • πŸ“„ csv_name: Name of the CSV file.

πŸ“– get_last_edit_time(file_path::String)

πŸ•° Gets the last edit time of a file.

  • Input:
    • πŸ“‚ file_path: Path to the file.
  • Output:
    • πŸ“… Last edit time in Dates format.

πŸ“– search_files_by_ext(root_dir, file_ext)

πŸ” Recursively looks for all files in folders and subfolders based on file extension.

  • Input:
    • πŸ“‚ root_dir: Root directory.
    • πŸ“„ file_ext: Extension of a file to search for (e.g., ".dcm").
  • Output:
    • πŸ“‹ List of found paths.

πŸ“– search_files_by_name(root_dir, file_name)

πŸ” Recursively looks for the target file by name.

  • Input:
    • πŸ“‚ root_dir: Root directory.
    • πŸ“„ file_name: Name of the target file.
  • Output:
    • πŸ“‹ Path to the target file (or an empty string if not found).

πŸ“– binary_search_SID(SIDs, target)

πŸ” Looks for a target element in an array (binary search). The input array should be sorted.

  • Input:
    • πŸ“‹ SIDs: List containing the target.
    • 🎯 target: The target element.
  • Output:
    • πŸ”’ Index of the target in the SID list (-1 if not found).

πŸ“– zoom_pixel_values(img)

πŸ” Zooms pixel values of an image to the range [0, 1].

  • Input:
    • πŸ–Ό img: Input image.
  • Output:
    • πŸ–Ό Zoomed image.

πŸ“– copy_file(old_path::String, new_path::String)

πŸ” Copies a file to a new path.

  • Input:
    • πŸ“‚ old_path: Old path of the file.
    • πŸ“‚ new_path: New path for the file.

πŸ“– clean_directory(directory::String)

πŸ” Deletes everything inside a directory.

  • Input:
    • πŸ“‚ directory: Directory to be cleaned.

πŸ“– normalize_img(img)

πŸ” Normalizes an image, making the mean of all pixel values 0 and the standard deviation 1.

  • Input:
    • πŸ–Ό img: Input image.
  • Output:
    • πŸ–Ό Normalized image.

🎨 PNG Tools

πŸ“– read_png(path_to_file::String)

πŸ” Reads a PNG file.

  • Input:
    • πŸ“‚ path_to_file: Path to the PNG file.
  • Output:
    • πŸ–Ό Image in Matrix{Float32} format.

πŸ“– get_breast_mask(raw_img::Matrix{Float32})

🎭 Finds the breast area and creates a mask.

  • Input:
    • πŸ–Ό raw_img: The raw image in Matrix{Float32} format.
  • Output:
    • 🎭 Binary mask in Matrix{Float32} format.

About

This repo provides many useful functions for DICOM, NIfTI, and PNG files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages