How to create Server from ImageServer interface based on path's image from local

I’m trying to build QuPath from source code and I want to write ome tiff images based on SVS images , The problem that i’m facing is i dont know how create server(ImageServer) based on local path from my computer , Is there any way to deal with that ?

Are you currently unable to build QuPath from source code? You said trying so I am not sure if you are stuck on that part. Is there some reason you can’t use a standard install of QuPath?

Are you doing this from the command line? Otherwise, if you have a project or an image loaded, you should not need to create a server, you can create a project, then use a script to export every image in the project as an OME.tif. Export scripts are on the documentation page.

1 Like

Yes , Actually I wanted to convert SVS to OmeTiff , in order to that i got the source code from QuPath, in order to write OmeTiff files, i figure that should be done by OMETiffWriter class from Qupath , That’s why i got all dependencies in order to compile it without errors , but in order to write these files , there is no way to just put the path of the input image(writeImage method must have ImageServer type as input ) , That’s the problem , i want to know is there any way to just set the path from my computer and write ome tiff images

I’m a little confused, but it sounds like you are trying to just use command line calls to directly covert one file into another? Have you tried opening the original image in QuPath and using the export image tool (File > Export Images > OME TIFF)? Does that give you the result you want?

1 Like

That is also a thing if you have QuPath installed - there is a specific command line call to write out an OME-TIFF, but it runs through QuPath (even though QuPath does not technically open). So it does not require “building from source,” which I am still hung up on.

https://qupath.readthedocs.io/en/latest/docs/advanced/command_line.html#windows


Notice the “convert-ome” option that I generally use to convert images to ome.tiff. Using Python, the process can be batched across an entire folder… though the same could also be done using a script within QuPath. Not sure there are huge benefits either way.

1 Like


First I wanted to write OMETiff image based on Tif Image using this class ,
The class itself uses this function (writeImage) as shown
That’s why i create an instance from this class and then i called writeImage’s function to do the needed work , But that doesnt work (I used the source code from QuPath)

This is confusing because you can write OME-TIFF files from QuPath without downloading or building the source code at all. @smcardle and @Research_Associate have described two ways to do this: one through the GUI, one from the command line.

Your approach sounds much more complicated, and it still isn’t clear to me why, if you goal is just to convert SVS images to OME-TIFF.

Note that you can also use bfconvert: Converting a file to different format — Bio-Formats 6.6.1 documentation

1 Like

If you really need to construct an ImageServer yourself, you can try

var server = ImageServerProvider.buildServer("/path/to/server.svs", java.awt.image.BufferedImage.class);

But I would highly recommend leaving it up to QuPath to do the hard work, and use the command line option with convert-ome subcommand – which was developed for this purpose.