saalfeldlab / render

Render transformed image tiles
GNU General Public License v2.0
34 stars 32 forks source link

N5 export, contrast range #123

Closed martinschorb closed 2 years ago

martinschorb commented 2 years ago

Hi,

I have a render stack where the raw data is 16bit images with a rather narrow intensity distribution. Upon export this is converted to 8bit and thus I am losing pretty much all dynamic range present in the original data.

Is there a way to choose the intensity range similar to the API calls (minIntensity=0&maxIntensity=15000) for the export script? I checked the source but could not find such parameters, maybe they already exist in a parent class and I haven't found them yet... Thanks!

martinschorb commented 2 years ago

another option would obviously be to enable N5 export without type conversion (as the original 16 bit).

trautmane commented 2 years ago

Hi Martin,

As you discovered, 16-bit support doesn't currently exist for the N5 exporter. I'll take a look and see if I can quickly add an option for you in the next day or two. I'm thinking that if your intensity distribution is narrow, the current code might also work if you explicitly set the minIntensity and maxIntensity values (to the small range) in the source tile specs - did you try that?

--Eric

trautmane commented 2 years ago

Hey - I just committed this https://github.com/saalfeldlab/render/commit/94811ab13c0579d3a397d6cad7a04378ad37c564 . Can you try it out and let me know if it solves your issue?

martinschorb commented 2 years ago

Cool, I just tried to build and it seems there is an expired or broken certificate somewhere...

[ERROR] Failed to execute goal on project render-ws: Could not resolve dependencies for project org.janelia.render:render-ws:war:2.3.1-SNAPSHOT: Failed to collect dependencies at org.janelia.render:render-app:jar:2.3.1-SNAPSHOT -> sc.fiji:Descriptor_based_registration:jar:2.1.7: Failed to read artifact descriptor for sc.fiji:Descriptor_based_registration:jar:2.1.7: Could not transfer artifact sc.fiji:Descriptor_based_registration:pom:2.1.7 from/to imagej.public (https://maven.scijava.org/content/groups/public): Transfer failed for https://maven.scijava.org/content/groups/public/sc/fiji/Descriptor_based_registration/2.1.7/Descriptor_based_registration-2.1.7.pom: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
trautmane commented 2 years ago

Are you able to get to https://maven.scijava.org/content/groups/public/sc/fiji/Descriptor_based_registration/2.1.7 in a browser?

martinschorb commented 2 years ago

Yes, I can see the directory listing there.

martinschorb commented 2 years ago

I can also wget it on the build machine.

trautmane commented 2 years ago

It looks like the java installation wherever you are building does not like the cert on the maven.scijava.org server: https://stackoverflow.com/questions/48593183/maven-unable-to-find-valid-certification-path

martinschorb commented 2 years ago

That's the JDK that is shipped in the render install script. render/deploy/jdk1.8.0_131

martinschorb commented 2 years ago

and I get the same issue when trying to build on another machine. (this time the one that currently runs the render web server)

martinschorb commented 2 years ago

the build runs through with the current JDK from https://adoptium.net/releases.html?variant=openjdk8

trautmane commented 2 years ago

Yeah - the install script has an ancient jdk from 2017. I currently build with Oracle 1.8.0_241 on my Mac and our render servers run either OpenJDK 1.8.0_302 or 8.0.275.fx-zulu from Azul. I'll look into updating the install script JDK, but that may take me some time. Can you try installing a more recent JDK 8 (any recent one should do if you don't like either of the ones I just mentioned) and building with that?

Another option is to build within Docker, since that build just uses the latest Open JDK 8. To do that, you need Docker installed and a local copy of the git repo (don't forget to switch to geometric-descriptor branch). With that ...

# cd to root directory of render repo (where Dockerfile is located) 
# saves JAR and WAR files in /root/render-lib 
docker build -t render-ws:latest-build --target builder .

# create a dummy container so you can pull out the built jar files
docker create -ti --name dummy render-ws:latest-build bash

# copy the build artifacts out of the dummy container (results will be in ./render-lib)
docker cp -r dummy:/root/render-lib .
martinschorb commented 2 years ago

Confirm that the intensity mapping works. Thanks for them amazingly quick response! 🚀