mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
28 stars 12 forks source link

Creating Grid Views via Project Creator API #667

Open tischi opened 2 years ago

tischi commented 2 years ago

@CamachoDejay

It loos like you like to have such "grid views":

image

@CamachoDejay How do you currently achieve this?

I am asking, because we have some dedicated functionality to automatically put many images into a grid, but I am not sure we yet make this convenient in the ProjectCreator API, do we? @K-Meech

constantinpape commented 2 years ago

@KateMoreva has already put some work into doing this programatically, but we haven't merged it yet, see #416.

K-Meech commented 2 years ago

Yes - there's nothing in project creator for grids yet. We'd need to merge @KateMoreva 's work first!

CamachoDejay commented 2 years ago

Hej @tischi,

At the moment I used the macro language (groovy) to accomplish this. Basically a user defined function that takes as input the x and y translation in microns.

def load_section(idx, dataDir, datasetName, uiSelectionGroup, xtranslate, ytranslate){
    //idx is unique to my application naming convention
    sectionsPath = dataDir + "Slide_"+idx+".czi";
       // I use your nice helper to get the data as an image plus
    imp = MoBIEHelper.openWithBioFormats( sectionsPath, 0 );
    imp.show();

    channels = ChannelSplitter.split( imp );
    for ( c = 0; c < channels.length; c++ )
    {
        imageName = "Slide_"+idx+"_c" + c;
        affineTransform3D = new AffineTransform3D();
               // here comes the "grid"
        affineTransform3D.translate( new double[]{ xtranslate, ytranslate, 0} );
        images.addImage( channels[ c ], imageName, datasetName, ImageDataFormat.OmeZarr, 
                ProjectCreator.ImageType.image, affineTransform3D, uiSelectionGroup );
    }

    imp.close();
}

As you can see it is not fancy at all. Then I just had a helper function to create the x-y shifts in microns give the desired distance and the desired distribution e.g. 4x3

tischi commented 2 years ago

This is in fact, quite cool, we do essentially nothing else with the grid functionality.

tischi commented 1 month ago

Hi @KateMoreva @K-Meech,

FYI: There are now more users requesting the creation of grid views. I will thus try to look into this...if you there's anything I should know, please let me know.

KateMoreva commented 1 month ago

Hi @KateMoreva @K-Meech,

FYI: There are now more users requesting the creation of grid views. I will thus try to look into this...if you there's anything I should know, please let me know.

Hi @tischi,

I'll try to take a look at the code this weekend.

tischi commented 1 month ago

Hi @KateMoreva,

Nice! Thanks! You will have to rebase your code, because the main branch changed a lot 😄 ! And please develop against the main branch (not against develop as before).