Skip to content

Commit

Permalink
Merge pull request #100 from Artur-man/main
Browse files Browse the repository at this point in the history
updating windows compilers for TPS interpolation
  • Loading branch information
Artur-man authored May 21, 2024
2 parents dd68378 + a4d8e29 commit 838ca85
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 115 deletions.
2 changes: 1 addition & 1 deletion R/annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ annotateSpatialData <- function(object, label = "annotation", assay = NULL, use.
} else {
spatialpoints <- rownames(metadata)
}

new_label <- rep("undefined", length(spatialpoints))
names(new_label) <- spatialpoints
result_list <- list()
Expand Down Expand Up @@ -339,4 +340,3 @@ annotateSpatialData <- function(object, label = "annotation", assay = NULL, use.
shiny::runApp(shiny::shinyApp(ui, server))
}
}

12 changes: 10 additions & 2 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ vrSpatialPlot <- function(object, group.by = "Sample", plot.segments = FALSE, gr
return(gg[[1]] + theme(legend.position=legend.loc))
}
} else {
gg + theme(legend.position=legend.loc)
for(i in 1:length(assay_names)){
gg[[i]] <- gg[[i]] + theme(legend.position=legend.loc)
}
return(gg)
}
}

Expand Down Expand Up @@ -259,6 +262,7 @@ vrSpatialPlotSingle <- function(assay, metadata, group.by = "Sample", plot.segme
} else {
coords[[group.by]] <- metadata[,group.by]
}

if(!is.null(group.ids)){
if(length(setdiff(group.ids, coords[[group.by]])) > 0){
# warning("Some groups defined in group.ids does not exist in group.by!")
Expand Down Expand Up @@ -358,6 +362,7 @@ vrSpatialPlotSingle <- function(assay, metadata, group.by = "Sample", plot.segme

# add points
if(n.tile == 0){

g <- g +
geom_point(mapping = aes_string(x = "x", y = "y", fill = group.by, color = group.by), coords, shape = cell.shape, size = rel(pt.size), alpha = alpha) +
scale_fill_manual(values = colors, labels = names(colors), drop = FALSE, limits = names(colors)) +
Expand Down Expand Up @@ -591,7 +596,10 @@ vrSpatialFeaturePlot <- function(object, features, group.by = "label", plot.segm
return(gg[[1]] + theme(legend.position=legend.loc))
}
} else {
return(gg + theme(legend.position=legend.loc))
for(i in 1:(length(features)*length(assay_names))){
gg[[i]] <- gg[[i]] + theme(legend.position=legend.loc)
}
return(gg)
}
}

Expand Down
11 changes: 0 additions & 11 deletions cleanup
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
#!/bin/sh
rm -f src/Makevars configure.log autobrew
rm -Rf .deps

rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
Expand Down
24 changes: 9 additions & 15 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
VERSION = 4.7.0
RWINLIB = ../windows/opencv-$(VERSION)
RWINLIB = ../windows/opencv
PKG_CPPFLAGS = -I$(RWINLIB)/include/opencv4 -DHAVE_XFEATURES2D
TARGET = lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH)
OLDLIBDIR = lib${subst gcc,,${COMPILED_BY}}${R_ARCH}

PKG_LIBS = \
$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) \
-L$(RWINLIB)/$(TARGET) \
-L$(RWINLIB)/lib$(R_ARCH) \
-lopencv_ml470 -lopencv_objdetect470 -lopencv_photo470 -lopencv_stitching470 \
-lopencv_video470 -lopencv_calib3d470 -lopencv_xfeatures2d470 -lopencv_features2d470 -lopencv_highgui470 -lopencv_flann470 \
-lopencv_videoio470 -lopencv_imgcodecs470 -lopencv_imgproc470 -lopencv_core470 -llibopenjp2 -lquirc -ltbb \
-ljpeg -lwebp -lpng -lz -ltiff \
-lcomctl32 -lgdi32 -lole32 -lsetupapi -lws2_32 -lavifil32 -lavicap32 -lwinmm -lmsvfw32 \
-lopengl32 -lglu32 -lcomdlg32 -lOleAut32 -luuid

CXX_STD=CXX11
-L$(RWINLIB)/$(OLDLIBDIR) \
-L$(RWINLIB)/lib \
-lopencv_ml481 -lopencv_objdetect481 -lopencv_photo481 -lopencv_stitching481 -lopencv_shape481 -lopencv_wechat_qrcode481 -lopencv_dnn481 \
-lopencv_video481 -lopencv_calib3d481 -lopencv_xfeatures2d481 -lopencv_features2d481 -lopencv_highgui481 -lopencv_flann481 \
-lopencv_videoio481 -lopencv_imgcodecs481 -lopencv_imgproc481 -lopencv_core481 -llibopenjp2 -lquirc \
-ljpeg -lwebp -lsharpyuv -lpng -lz -ltiff -lpthread -lgdi32 -lole32 -lopengl32 -lcomdlg32 -lOleAut32 -luuid

all: clean winlibs

Expand All @@ -24,4 +18,4 @@ clean:
winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" ${VERSION}
mkdir -p ../inst
cp -r $(RWINLIB)/share ../inst/
cp -r $(RWINLIB)/share ../inst/
75 changes: 0 additions & 75 deletions src/manual_registration.cpp

This file was deleted.

28 changes: 17 additions & 11 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# We need https
if(getRversion() < "3.3.0") setInternet2()
VERSION <- commandArgs(TRUE)

# Downloads libssh2 + dependencies
options(timeout = 400)
if(!file.exists(sprintf("../windows/opencv-%s/include/opencv4/opencv2/opencv.hpp", VERSION))){
download.file(sprintf("https://github.com/rwinlib/opencv/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE)
if(!file.exists("../windows/opencv/include/opencv4/opencv2/opencv.hpp")){
unlink("../windows", recursive = TRUE)
url <- if(grepl("aarch", R.version$platform)){
"https://github.com/r-windows/bundles/releases/download/opencv-4.8.1/opencv-4.8.1-clang-aarch64.tar.xz"
} else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){
"https://github.com/r-windows/bundles/releases/download/opencv-4.8.1/opencv-4.8.1-clang-x86_64.tar.xz"
} else if(getRversion() >= "4.3") {
"https://github.com/r-windows/bundles/releases/download/opencv-4.8.1/opencv-4.8.1-ucrt-x86_64.tar.xz"
} else {
"https://github.com/rwinlib/opencv/archive/refs/tags/v4.8.1.tar.gz"
}
download.file(url, basename(url), quiet = TRUE)
dir.create("../windows", showWarnings = FALSE)
unzip("lib.zip", exdir = "../windows")
unlink("lib.zip")
}
untar(basename(url), exdir = "../windows", tar = 'internal')
unlink(basename(url))
setwd("../windows")
file.rename(list.files(), 'opencv')
}

0 comments on commit 838ca85

Please sign in to comment.