Closed martinschorb closed 2 years ago
@NicoKiaru what do you fetch back from BigWarp when an affine transform was used. Is it a TransformedSource
? If that's the case, maybe one can introspect the source to see which affine transform was added by BigWarp? I remember there was some way in the playground to introspect sources, but I don't know now exactly how that worked.
The BigWarp moving source is appearing as transformed ..._xfm_0
source in the BDV-PG source list. It has this cube icon, so I assume it is a warped source. When I choose "affine" as BigWarp Transform Type, there should be a way of extracting this affine transform somehow similar to doing a BDV-PG manual transform and then exporting it.
I would be fine even with exporting a re-sampled source for now, but I do not manage to get this done with proper resolution.
I had a look into the code and found this:
@Plugin(type = BdvPlaygroundActionCommand.class, menuPath = ScijavaBdvDefaults.RootMenu+"Save Bdv Playground State (experimental)")
Do you have this menu item in your version? This could give you a json with all the Sources serialized. Maybe there you can find the affine transform in the warped sources. But I am not sure as I am not sure how the warped sources returned by BigWarp internally look like, maybe @bogovicj can help?
@NicoKiaru what do you fetch back from BigWarp when an affine transform was used. Is it a
TransformedSource
?
I get a WarpedSource, because it's more general. But the transformation should be accessible with ((WarpedSource) source).getTransform()
. Would that work ?
Sorry for missing this until now. I think @NicoKiaru will be the most help, since he's done the nicest work on serializing transforms in a clean way.
I'll add some information that may be helpful for now anyway. A WarpedSource
just needs a source and a RealTransform
where the transform takes points from target to source space
Something like this would build a WarpedSource from your original source and landmarks saved from Bigwarp:
Source mysource; // the source to warp
// load bigwarp landmarks and make the transform
LandmarkTableModel ltm = new LandmarkTableModel(3); // 3d
ltm.load( new File("myLandmarks.csv"));
InvertibleRealTransform transform = new BigWarpTransform( ltm, TransformTypeSelectDialog.TPS ).getTransformation();
// make the warped source
WarpedSource warpedSource = new WarpedSource( mysource, mysource.getName() + "_warped" );
warpedSource.updateTransform(transform);
Closing this issue for now. It can be done, but maybe to get a nice user interface it's better to make a command in another repo for the specific case you want to use. (see warpy wizard ui for instance: https://www.youtube.com/watch?v=s5GoNND6Mho)
Hi,
I have registered some sources in BigWarp. Now I want to use the registered sources in MoBIE and hence want to either
If I try this (2) using (Export source as XML/HDF5), there always is significant downsampling and loss of resolution.
What is the proper way?