crop.stack {GoodFibes}R Documentation

Automated imaging cropping

Description

Automatically crops a stack of png image files to the minimum bounds of non-black values. Or if bounds are supplied can be cropped to the exact size of another stack of images.

Usage

crop.stack(images, bounds = NULL, save.images=FALSE)

Arguments

images

A vector with file names for the image files, can be created with list.files.

bounds

An optional vector with four values, given as c(xlim, xmax, ylim, ymax). These are printed at the end of the function when cropping is performed automatically.

save.images

When TRUE, images are saved to the current directory using imager::save.image.

Value

The bounds to be used for cropping. Optionally crops and saves images to working folder.

Author(s)

J. Arbour

References

Arbour, J. In Prep. GoodFibes: an R package for the detection of muscle fibers from diceCT scans.

See Also

equalize.stack

Examples



olddir<-getwd()

#### this downloads the ant dataset image stack
#### if you have it already downloaded you can navigate to that folder
setwd(tempdir())
download.file(url=
"https://github.com/jessica-arbour/Ant-Muscle-Image-Stack/raw/main/Ant_data.zip",
destfile="antdata.zip")

unzip("antdata.zip")
setwd(paste0(getwd(),"/Ant data"))
####

images<-list.files(pattern=".png")

crop.stack(images)

setwd(olddir)





[Package GoodFibes version 0.1.10 Index]