BIOP / qupath-extension-warpy

ImgLib2 RealTransform brought to QuPath
Apache License 2.0
19 stars 5 forks source link

Does Warpy can be used in script? Do you have introduction? #17

Open HanYanxi opened 10 months ago

HanYanxi commented 10 months ago

I need to process lots of images. Can I use the command like run('Warpy') to use it?

NicoKiaru commented 10 months ago

Unfortunately, there's no easy way to batch Warpy currently, but it's on our TODO list at the facility.

It will become possible, but nothing will be done before next month. I hope to have a batch feature available by the end of 2023.

ping @romainGuiet

HanYanxi commented 10 months ago

Thank you! And if I have an image like this, could you give me some advice to set the parameters in the beginning? image

NicoKiaru commented 10 months ago

Oh, whoa, these are gigantic pixels! Are you sure of these ? The object you image is 2 meters long ?

If that's correct, I would try something like:

Pixel size coarse = 800 Patch size = 40000 Pixel size precise = 80

iteration = 100 (same)

Basically everything multiplied by 80,

HanYanxi commented 10 months ago

It's a whole slide of fluorescent. Yes, you are right. It's impossible. Because when I followed your YouTube video. It produced the pixel width and length automatically. But I don't know the physical size of this slide. It's a problem. Can I adjust them like pixel width 0.84, and pixel length 0.84?

HanYanxi commented 10 months ago

Can I ask one more question about the registration process? Because I am using 2D images to register. What does the "remove images z-offset" do in the first step?

NicoKiaru commented 10 months ago

What does the "remove images z-offset" do in the first step?

You can keep it checked without any issue. It's a subtle issue: the planes are positioned along Z in the bio-formats library. And the z-offset can be different between the moving and the fixed image. By keeping this option checked, you make sure that the offset is ignored - which is what you want to do in 99% of the cases.

elect86 commented 10 months ago

I need to process lots of images. Can I use the command like run('Warpy') to use it?

Maybe I may help: what kind of processing are you looking for, exactly? How do you process right now a single image and where are the images you would like to batch? All in one folder?

NicoKiaru commented 10 months ago

Hi @elect86 !

The batching is possible in theory but it is rather annoying right now. The Warpy wizards runs commands within commands and uses the SciJava framework to pass arguments.

The main Warpy wizard command is here:

https://github.com/BIOP/bigdataviewer-biop-tools/blob/master/src/main/java/ch/epfl/biop/scijava/command/source/register/WarpyRegisterCommand.java

And calls this command... which is doing some stuff in the UI, so not ideal for batching.

https://github.com/BIOP/bigdataviewer-biop-tools/blob/master/src/main/java/ch/epfl/biop/scijava/command/source/register/Wizard2DWholeScanRegisterCommand.java

I need to re-design these commands, or make a parallel API for easy batching. I should have known that it was bad design, even from the start... but well, here's another lesson I needed to taught myself one more time.

HanYanxi commented 10 months ago

What does the "remove images z-offset" do in the first step?

You can keep it checked without any issue. It's a subtle issue: the planes are positioned along Z in the bio-formats library. And the z-offset can be different between the moving and the fixed image. By keeping this option checked, you make sure that the offset is ignored - which is what you want to do in 99% of the cases.

Okay! Thank you. May I ask do you know some plugins could do remove z-offsets in imageJ?

NicoKiaru commented 10 months ago

May I ask do you know some plugins could do remove z-offsets in imageJ?

I'm not sure what's the context of your demand. Honestly, I don't think it's an issue you will encounteer anywhere else than in Warpy

HanYanxi commented 10 months ago

I need to process lots of images. Can I use the command like run('Warpy') to use it?

Maybe I may help: what kind of processing are you looking for, exactly? How do you process right now a single image and where are the images you would like to batch? All in one folder?

Hi @elect86, It looks: like I have 3 images, they are in the same folder. And I want to use Warpy to align them. But I want to do it automatically. Because I have maybe more than 5 folders.

HanYanxi commented 10 months ago

May I ask do you know some plugins could do remove z-offsets in imageJ?

I'm not sure what's the context of your demand. Honestly, I don't think it's an issue you will encounteer anywhere else than in Warpy

Does that mean "removing the z-offsets" and "center moving image with fixed image" are used for manual rigid registration?

NicoKiaru commented 10 months ago

Does that mean "removing the z-offsets" and "center moving image with fixed image" are used for manual rigid registration?

Both options are there to help with the initial state. There are not used per se for the registration. It's just that if the images are not overlapping at all when you start the registration process, the wizard will just not work. So, initially, you just want to re-center both images. That's what these options are for. It's just there to help at the beginning of the registration process.

You can just experiment and see what happens if you disable them.

HanYanxi commented 10 months ago

Does that mean "removing the z-offsets" and "center moving image with fixed image" are used for manual rigid registration?

Both options are there to help with the initial state. There are not used per se for the registration. It's just that if the images are not overlapping at all when you start the registration process, the wizard will just not work. So, initially, you just want to re-center both images. That's what these options are for. It's just there to help at the beginning of the registration process.

You can just experiment and see what happens if you disable them.

Okay! Thank you so much for your reply!

HanYanxi commented 10 months ago

Can I ask a question about Warpy registration? When I start registration, it shows these errors, and I can't export the registered images using "export warpy registered image". image

NicoKiaru commented 10 months ago

Yeah, the export from Warpy is indeed broken currently, sorry. I've opened an issue (https://github.com/BIOP/bigdataviewer-biop-tools/issues/55).

The current alternative is to export from QuPath, cf:

https://forum.image.sc/t/saving-to-ome-tiff-slow-warpy-and-qupath/69153

HanYanxi commented 10 months ago

Yeah, the export from Warpy is indeed broken currently, sorry. I've opened an issue (BIOP/bigdataviewer-biop-tools#55).

The current alternative is to export from QuPath, cf:

https://forum.image.sc/t/saving-to-ome-tiff-slow-warpy-and-qupath/69153

okay, thank you. When I did registration it also shows errors. image

NicoKiaru commented 10 months ago

Is Fiji up to date ? Do you have elastix 5.0.1 ( and not elastix 5.1.0 ) ?

Please check the script refered in https://biop.github.io/ijp-imagetoatlas/#i-cant-start-any-elastix-registrations

And make sure that you select 'MILLIMETER' when importing the QuPath project

HanYanxi commented 10 months ago

image the folders are like this, I didn't change them.

NicoKiaru commented 10 months ago

Ah, ok.

Could you try to run the test script mention in the link I've sent above and let me know how that goes ?