Skip to content

Commit

Permalink
add min and max layers in summary
Browse files Browse the repository at this point in the history
  • Loading branch information
buddekai committed Dec 20, 2023
1 parent 0989542 commit 7e0edcd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 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.4
Version: 0.7.5
Authors@R:
person("Kai", "Budde-Sagert", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-6836-9865"))
Expand Down
21 changes: 14 additions & 7 deletions R/summarizeCiliaInformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ summarizeCiliaInformation <- function(

df_cilium_summary <- data.frame(cilium = sort(number_of_cilia),
cilium_shape = NA,
lowest_cilium_layer = NA,
uppermost_cilium_layer = NA,
vertical_length_in_um = NA,
vertical_length_in_layers = NA,
horizontal_length_in_um = NA,
Expand All @@ -49,6 +51,9 @@ summarizeCiliaInformation <- function(
vertical_length_in_layers <- upper_layer-lower_layer + 1 # in z stack layers
vertical_length_in_um <- (upper_layer - lower_layer + 1) * slice_distance # in \mu m
}else{
lower_layer <- NA
upper_layer <- NA

vertical_length_in_layers <- NA
vertical_length_in_um <- NA
}
Expand All @@ -70,7 +75,7 @@ summarizeCiliaInformation <- function(

# The side with more points shall represent the x-axis in the regression
if(number_of_pos_y_points > number_of_pos_x_points){
# print(paste("Cilium Nr. ", i, " is elongated in x-direction more than in y-direction.", sep=""))
# print(paste("Cilium no. ", i, " is elongated in x-direction more than in y-direction.", sep=""))
# column is x-axis (as usually)
linear_model <- lm(pos_x ~ pos_y, df_cilium_projection)
slope <- as.numeric(linear_model$coefficients[2])
Expand All @@ -85,7 +90,7 @@ summarizeCiliaInformation <- function(
horizontal_length_in_um <- horizontal_length_in_pixels * pixel_size # in \mu m

}else{
# print(paste("Cilium Nr. ", i, " is elongated in y-direction more than in x-direction.", sep=""))
# print(paste("Cilium no. ", i, " is elongated in y-direction more than in x-direction.", sep=""))
# pos_x is x-axis
linear_model <- lm(pos_y ~ pos_x, df_cilium_projection)
slope <- as.numeric(linear_model$coefficients[2])
Expand All @@ -104,12 +109,14 @@ summarizeCiliaInformation <- function(
# Total length of the cilium
total_length_in_um <- sqrt(horizontal_length_in_um*horizontal_length_in_um + vertical_length_in_um*vertical_length_in_um)

df_cilium_summary$cilium_shape[df_cilium_summary$cilium == i] <- cilium_shape
df_cilium_summary$vertical_length_in_um[df_cilium_summary$cilium == i] <- vertical_length_in_um
df_cilium_summary$vertical_length_in_layers[df_cilium_summary$cilium == i] <- vertical_length_in_layers
df_cilium_summary$horizontal_length_in_um[df_cilium_summary$cilium == i] <- horizontal_length_in_um
df_cilium_summary$cilium_shape[df_cilium_summary$cilium == i] <- cilium_shape
df_cilium_summary$lowest_cilium_layer[df_cilium_summary$cilium == i] <- lower_layer
df_cilium_summary$uppermost_cilium_layer[df_cilium_summary$cilium == i] <- upper_layer
df_cilium_summary$vertical_length_in_um[df_cilium_summary$cilium == i] <- vertical_length_in_um
df_cilium_summary$vertical_length_in_layers[df_cilium_summary$cilium == i] <- vertical_length_in_layers
df_cilium_summary$horizontal_length_in_um[df_cilium_summary$cilium == i] <- horizontal_length_in_um
df_cilium_summary$horizontal_length_in_pixels[df_cilium_summary$cilium == i] <- horizontal_length_in_pixels
df_cilium_summary$total_length_in_um[df_cilium_summary$cilium == i] <- total_length_in_um
df_cilium_summary$total_length_in_um[df_cilium_summary$cilium == i] <- total_length_in_um
}

number_of_digits <- floor(sqrt(min_cilium_area))
Expand Down

0 comments on commit 7e0edcd

Please sign in to comment.