src/napari_tissuemaps_interface/napari_tissuemaps_interface.py
def apply(self, token=("", "", ""),
              experiment_name="",
              channel_name="") -> List[LayerDataTuple]:
        # pylint: disable=W0613
        """
        Function executed when the "Load Data" button is pressed.
        It calls the tissuemaps tissuemaps_interface and returns a napari
        Image layer

        :param token: The access token for querying TissueMAPS
        :param experiment_name: The name of a TissueMAPS experiment
        :param channel_name: The channel name of a TissueMAPS experiment
        :return: napari_layers.Image object, with access_token stored as metadata
        """
        exp_id = [exp["id"] for exp in self.experiments if exp["name"] == experiment_name][0]
        if channel_name == '-- All --':
            multi_layer = []
            for channel in self.channels:
                assert len(channel["layers"]) == 1
                for layer in channel["layers"]:
                    pyramid = tissuemaps_interface(
                        self.tm_connector.url.value,
                        token,
                        exp_id,
                        str(layer["id"])
                    )
                    res = (
                        pyramid, {
                            'name': channel['name'],
                            'metadata': {'token': self.tm_connector.token},
                            'opacity': 1.0 / len(self.channels),
                            'blending': 'additive'
                        },
                        'image'
                    )
                    multi_layer.append(res)
            return list(
                reversed(
                    sorted(multi_layer, key=lambda layer_data: layer_data[1]["name"])
                )
            )

        channels = [ch for ch in self.channels if ch["name"] == channel_name]
        assert len(channels) == 1
        layer_ids = [layer["id"] for layer in channels[0]["layers"]]
        assert len(layer_ids) == 1
        pyramid = tissuemaps_interface(
            self.tm_connector.url.value,
            token,
            exp_id,
            layer_ids[0]
        )
        return [(
            pyramid,
            {
                'name': channel_name,
                'metadata': {'token': self.tm_connector.token},
                'blending': 'additive'
            },
            'image'
        )]

        Function executed when the "Load Data" button is pressed.
        It calls the tissuemaps tissuemaps_interface and returns a napari
        Image layer

        :param token: The access token for querying TissueMAPS
        :param experiment_name: The name of a TissueMAPS experiment
        :param channel_name: The channel name of a TissueMAPS experiment
        :return: napari_layers.Image object, with access_token stored as metadata
        
Function executed when the "Load Data" button is pressed.
It calls the tissuemaps tissuemaps_interface and returns a napari
Image layer
Function executed when the " Load Data " button is pressed . It calls the tissuemaps tissuemaps_interface and returns a napari Image layer
def apply(self, token=("", "", ""),
              experiment_name="",
              channel_name="") -> List[LayerDataTuple]:
        exp_id = [exp["id"] for exp in self.experiments if exp["name"] == experiment_name][0]
        if channel_name == '-- All --':
            multi_layer = []
            for channel in self.channels:
                assert len(channel["layers"]) == 1
                for layer in channel["layers"]:
                    pyramid = tissuemaps_interface(
                        self.tm_connector.url.value,
                        token,
                        exp_id,
                        str(layer["id"])
                    )
                    res = (
                        pyramid, {
                            'name': channel['name'],
                            'metadata': {'token': self.tm_connector.token},
                            'opacity': 1.0 / len(self.channels),
                            'blending': 'additive'
                        },
                        'image'
                    )
                    multi_layer.append(res)
            return list(
                reversed(
                    sorted(multi_layer, key=lambda layer_data: layer_data[1]["name"])
                )
            )
        channels = [ch for ch in self.channels if ch["name"] == channel_name]
        assert len(channels) == 1
        layer_ids = [layer["id"] for layer in channels[0]["layers"]]
        assert len(layer_ids) == 1
        pyramid = tissuemaps_interface(
            self.tm_connector.url.value,
            token,
            exp_id,
            layer_ids[0]
        )
        return [(
            pyramid,
            {
                'name': channel_name,
                'metadata': {'token': self.tm_connector.token},
                'blending': 'additive'
            },
            'image'
        )]
def apply ( self , token = ( "" , "" , "" ) , experiment_name = "" , channel_name = "" ) -> List [ LayerDataTuple ] : exp_id = [ exp [ "id" ] for exp in self . experiments if exp [ "name" ] == experiment_name ] [ 0 ] if channel_name == '-- All --' : multi_layer = [ ] for channel in self . channels : assert len ( channel [ "layers" ] ) == 1 for layer in channel [ "layers" ] : pyramid = tissuemaps_interface ( self . tm_connector . url . value , token , exp_id , str ( layer [ "id" ] ) ) res = ( pyramid , { 'name' : channel [ 'name' ] , 'metadata' : { 'token' : self . tm_connector . token } , 'opacity' : 1.0 / len ( self . channels ) , 'blending' : 'additive' } , 'image' ) multi_layer . append ( res ) return list ( reversed ( sorted ( multi_layer , key = lambda layer_data : layer_data [ 1 ] [ "name" ] ) ) ) channels = [ ch for ch in self . channels if ch [ "name" ] == channel_name ] assert len ( channels ) == 1 layer_ids = [ layer [ "id" ] for layer in channels [ 0 ] [ "layers" ] ] assert len ( layer_ids ) == 1 pyramid = tissuemaps_interface ( self . tm_connector . url . value , token , exp_id , layer_ids [ 0 ] ) return [ ( pyramid , { 'name' : channel_name , 'metadata' : { 'token' : self . tm_connector . token } , 'blending' : 'additive' } , 'image' ) ]
Function executed when the "Load Data" button is pressed.
Function executed when the " Load Data " button is pressed .
# pylint: disable=W0613 """
        Function executed when the "Load Data" button is pressed.
        It calls the tissuemaps tissuemaps_interface and returns a napari
        Image layer

        :param token: The access token for querying TissueMAPS
        :param experiment_name: The name of a TissueMAPS experiment
        :param channel_name: The channel name of a TissueMAPS experiment
        :return: napari_layers.Image object, with access_token stored as metadata
        """
napari_layers.Image object, with access_token stored as metadata
napari_layers . Image object with access_token stored as metadata
self
token
The access token for querying TissueMAPS
The access token for querying TissueMAPS
experiment_name
The name of a TissueMAPS experiment
The name of a TissueMAPS experiment
channel_name
The channel name of a TissueMAPS experiment
The channel name of a TissueMAPS experiment