add transformations to tile

This commit is contained in:
2021-07-13 10:15:26 +02:00
parent f447157d35
commit 5e1875db40
3 changed files with 32 additions and 5 deletions

View File

@@ -1,22 +1,32 @@
import numpy as np import numpy as np
from situr.image.situ_image import SituImage from situr.image.situ_image import SituImage
from situr.transformation import IdentityRoundTransform
class Tile: class Tile:
''' '''
* Rounds 5 Rounds 5
* Channels 4+1 - spot colours + nuclei Channels 4+1 - spot colours + nuclei
* Z 1 to 30 - focus level Z 1 to 30 - focus level
* Y 2048 Y 2048
* X 2048 X 2048
''' '''
def __init__(self, file_list, nucleaus_channel=4): def __init__(self, file_list, nucleaus_channel=4):
self.images = [] self.images = []
self.round_transformations = []
for situ_image_list in file_list: for situ_image_list in file_list:
self.images.append( self.images.append(
SituImage(situ_image_list, nucleaus_channel=nucleaus_channel)) SituImage(situ_image_list, nucleaus_channel=nucleaus_channel))
self.round_transformations.append(IdentityRoundTransform())
def apply_transformations():
# TODO: implement (first apply channel transformations then round transformations)
pass
def set_round_transformation(self, round, transformation):
self.round_transformations[round] = transformation
def get_round_count(self): def get_round_count(self):
return len(self.images) return len(self.images)

View File

@@ -1 +1,2 @@
from .channel_transformation import ChannelTransform, IdentityChannelTransform, ScaleRotateTranslateChannelTransform from .channel_transformation import ChannelTransform, IdentityChannelTransform, ScaleRotateTranslateChannelTransform
from .round_transformation import RoundTransform, IdentityRoundTransform

View File

@@ -0,0 +1,16 @@
import abc
class RoundTransform:
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def apply_transformation(self, situ_tile, channel):
"""Performs a transformation on one channel, all focus_levels are transformed the same way"""
raise NotImplementedError(
self.__class__.__name__ + '.apply_transformation')
class IdentityRoundTransform(RoundTransform):
def apply_transformation(self, situ_tile, channel):
pass