Skip to content

Commit

Permalink
update to v0.8.0 (clean up functions)
Browse files Browse the repository at this point in the history
  • Loading branch information
buddekai committed Jan 17, 2024
1 parent d766386 commit c63fde9
Show file tree
Hide file tree
Showing 14 changed files with 244 additions and 382 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: detectCilia
Title: Detect and measure the lengths of primary cilia in microsopy images
Version: 0.7.6
Version: 0.8.0
Authors@R:
person("Kai", "Budde-Sagert", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-6836-9865"))
Expand Down
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(addNumberToImage)
export(detectCilia)
export(editImage)
export(getLayer)
export(summarizeCiliaInformation)
import(graphics)
import(stats)
importFrom(magrittr,"%>%")
Expand Down
1 change: 0 additions & 1 deletion R/addNumberToImage.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#' added.
#'
#' @return An array (image) with added number.
#' @export addNumberToImage

addNumberToImage <- function(image = NULL,
number = NULL,
Expand Down
420 changes: 161 additions & 259 deletions R/detectCilia.R

Large diffs are not rendered by default.

32 changes: 13 additions & 19 deletions R/editImage.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#' @title editImage
#' @description Get the layer of the primary cilia
#' @details By using an x-y-3(rgb)-representation of an image, you can
#' extract the information of the cilia in an image and only use those pixel
#' that are above a certain threshold.
#' @aliases editimage imageedit imageEdit
#' @author Kai Budde-Sagert
#' @export editImage
#' @param image An three-dimensional array of numbers between 0 and 1
#' @param object_color A character (color of the staining of the object)
#' @param threshold A number (that determines the brightness of a pixel to
#' be counted as cilium pixel)
#' @returns An array (changed image).
#' Calculate binary mask
#'
#' `editImage()` masks an image layer depending on a threshold.
#'
#' @param image An three-dimensional array of numbers between 0 and 1.
#' @param object_color A character being the color of the staining of the
#' object to be masked.
#' @param threshold A number that determines the brightness of a pixel to
#' be counted as a cilium pixel.
#'
#' @returns A binary image.

editImage <- function(image = NULL,
object_color = NULL,
Expand Down Expand Up @@ -45,12 +43,8 @@ editImage <- function(image = NULL,
return()
}

# higher contrast of the cilia -------------------------------------------
#threshold <- threshold * sum(image_cilia[,])/sum(image_cilia[,]>0)
#print(threshold)
#print(sum(image_cilia[,])/sum(image_cilia[,]>0))
#print(threshold)

# Calculate binary mask of cilia pixels ----------------------------------

# Making sure that the calculated threshold is not above 1 or below 0
if(threshold > 1){
threshold <- 1
Expand Down
17 changes: 8 additions & 9 deletions R/getLayer.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#' @title getLayer
#' @description Get a specific layer of the image
#' @details By using an x-y-3(rgb)-representation of an image, you can
#' extract one layer.
#' @aliases getlayer
#' @author Kai Budde-Sagert
#' @export getLayer
#' @param image An three-dimensional array of numbers between 0 and 1
#' @param layer A character (color of the layer)
#' Get a specific layer of the image
#'
#' `getLayer()` extracts a specific layer of an image (being x-y-3(rgb)-
#' representation).

#' @param image An three-dimensional array of numbers between 0 and 1.
#' @param layer A character being the color of the layer.

#' @returns An array (specific channel of image).

getLayer <- function(image = NULL,
Expand Down
16 changes: 8 additions & 8 deletions R/resizeImage.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#' @title resizeImage
#' @description Resizes an image
#' @details Resizes an image with a given scaling factor
#' @aliases resizeimage
#' @author Kai Budde-Sagert
#' @export addNumberToImage
#' @param image An one to three-dimensional array of numbers between 0 and 1
#' @param number_size_factor A number (factor for resizing the number)
#' Resizes an image
#'
#' `resizeImage()` eesizes an image with a given scaling factor
#'
#' @param image A one to three-dimensional array of numbers between 0 and 1
#' @param number_size_factor A number being the factor for resizing the
#' image of a number.
#'
#' @returns An array (resized image).

resizeImage <- function(image = NULL,
Expand Down
29 changes: 14 additions & 15 deletions R/summarizeCiliaInformation.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#' @title summarizeCiliaInformation
#' @description Summarizes the information of found cilia in images
#' @details Input should be the result of detectCilia.R.
#' The output is a data frame with the lengths of the found cilia.
#' @aliases summarizeCiliumInformation summarizeciliainformation
#' @author Kai Budde-Sagert
#' @export summarizeCiliaInformation
#' Summarize the information of found cilia
#'
#' `summarizeCiliaInformation()` summarizes the information of cilia found
#' by the main function detectCilia.R. The output is a data frame with the
#' lengths of the found cilia.

#' @param df_cilium_information A data frame with found cilia.
#' @param min_cilium_area A number for the minimum number of pixels needed
#' to represent a cilium.
#' @param pixel_size A number depicting the size of one pixel in micrometers.
#' @param slice_distance A number depicting the distance of two consecutive
#' z-stack layers in micrometers.
#'
#' @import graphics
#' @import stats
#' @param df_cilium_information A data frame
#' @param min_cilium_area A number (min number of pixels needed for a layer being part of a cilium)
#' @param pixel_size A number (size of one pixel in micrometer)
#' @param slice_distance A number (distance of two consecutive slices in
#' z-direction in micrometer)
#'
#' @returns A tibble with summarized cilium information (lengths).

summarizeCiliaInformation <- function(
Expand Down Expand Up @@ -58,9 +60,6 @@ summarizeCiliaInformation <- function(
vertical_length_in_um <- NA
}




# Find pixels of z-projection ##
# Only keep non-duplicated columns pos_x and pos_y (all unique positions)
df_cilium_projection <- df_cilium_projection[,c(1,2)]
Expand Down
4 changes: 0 additions & 4 deletions man/addNumberToImage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions man/detectCilia.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 8 additions & 18 deletions man/editImage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions man/getLayer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 5 additions & 11 deletions man/resizeImage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 10 additions & 16 deletions man/summarizeCiliaInformation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c63fde9

Please sign in to comment.