93af16066536a5673ae5cc0f357748348340c96a max Thu Nov 6 06:26:34 2025 -0800 typo diff --git src/cbPyLib/cellbrowser/R/cellbrowser.R src/cbPyLib/cellbrowser/R/cellbrowser.R index f03c3bd..139b48d 100644 --- src/cbPyLib/cellbrowser/R/cellbrowser.R +++ src/cbPyLib/cellbrowser/R/cellbrowser.R @@ -110,31 +110,31 @@ return(embeddings.conf) } img = GetImage(obj, mode="raw", image=name); if (is.null(img)) { message("The image is not a bitmap image, cannot export yet.") return(embeddings.conf) } imgPath <- file.path(outDir, paste0(name, ".jpg")) message("Writing image ", imgPath) #writePNG(img, imgPath); # JPEG seems like a better choice here, 4x smaller at default quality settings. writeJPEG(img, target=imgPath, quality=0.95); yMax = dim(img)[1]; xMax = dim(img)[2]; # there is a difference of 3 pixels on height when comparing "identify file.jpeg" with this. NO IDEA WHY! coordsPath <- file.path(outDir, paste0(name, ".coords.tsv")) message("Writing coords for image to ", coordsPath) - #coords <- GetTissueCoordinates(object = obj[[img]]) + coords <- GetTissueCoordinates(object = obj[[img]]) if (all(c("imagecol", "imagerow") %in% colnames(coords))) { # Seurat-style naming: reverse order coordsRev <- coords[, c("imagecol", "imagerow")] colnames(coordsRev) <- c("x", "y") } else if (all(c("x", "y") %in% colnames(coords))) { # Already in standard x/y format coordsRev <- coords[, c("x", "y")] } else { stop("Error: coordinates must have either (imagecol, imagerow) or (x, y) columns.") } write.table(coordsRev, coordsPath, sep="\t", row.names=T, quote=F, col.names=NA) conf <- sprintf( ' {\n "file": "%s",\n "shortLabel": "Spatial %s",\n "flipY":True,\n "images" : [{"file":"%s"}],\n "minX":0, "minY":0, "maxX":%d, "maxY":%d\n }',