mirror of
https://github.com/13hannes11/situr.git
synced 2024-09-03 20:50:58 +02:00
add transformations to tile
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
from .channel_transformation import ChannelTransform, IdentityChannelTransform, ScaleRotateTranslateChannelTransform
|
from .channel_transformation import ChannelTransform, IdentityChannelTransform, ScaleRotateTranslateChannelTransform
|
||||||
|
from .round_transformation import RoundTransform, IdentityRoundTransform
|
||||||
|
|||||||
16
situr/transformation/round_transformation.py
Normal file
16
situr/transformation/round_transformation.py
Normal 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
|
||||||
Reference in New Issue
Block a user