![]() But for bzip2 specifically, we will likely need to profile and address where CBZip2InputStream is slow, and/or find a more performant bzip2 decompression routine, to make bzip2 truly usable in the way that you want. The executive summary here is that and I are actively working on improving the SciJava Common + SCIFIO data handle API and supported plugins, so things will get better. The above script opens and displays the bzip2-compressed mitosis sample in ~2s on my system. Using other writers // Creates a FileWriter FileWriter file new FileWriter('output. Once we import the package here is how we can create the print writer. P = new ProcessBuilder("bzcat", file.getAbsolutePath()).start() In order to create a print writer, we must import the java.io.PrintWriter package first. For now, you can use a modified version of the above script that invokes bzcat as a subprocess: File LogService LocationService DatasetIOService Dataset dataset So there will always be some overhead to working with bzip2 streams. Faster, but still pretty slow, unfortunately.īy comparison: the bunzip2 CLI tool requires ~2.6s on my system to decompress the compressed mitosis sample. When opening the bzip2-compressed mitosis sample in this way, my system took ~19s for the decompression followed by ~100ms for the display. (Note that the use of ByteArrayByteBank above requires a newer version of SciJava Common than what ImageJ2 currently ships I tested with version 2.66.1.) Handle = new ByteArrayHandle(bank.toByteArray()) and also unfortunately make one more copy of the bytes. So for now, we need to do this nasty LocationService.mapFile thing, but we are still not done migrating SCIFIO to the updated framework. NB: We are in the process of rewriting the SCIFIO I/O support as Msg("Opening decompressed bytes of " + id) Id = file.getName().substring(0, file.getName().length() - FileUtils.getExtension(file).length() - 1) ![]() NB: Assume file is named 2, where foo.bar is the inner file. Is.read() is.read() // skip the BZ header Msg("Decompressing " + file.getAbsolutePath()) Here is the script: File LogService LocationService DatasetIOService Dataset dataset To further explore this, and as a potential short term workaround for you, I wrote a Groovy script that directly uses the CBZip2InputStream class to decompress in memory and then feed the resulting decompressed stream to SCIFIO. I saw a similar result with the File Import Image… command that uses SCIFIO.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |