Commit 6b6bf70d authored by inhuszar's avatar inhuszar
Browse files

Leaving for London.

parent fc9a9e62
#!/usr/bin/env python3
from tirl.timage import TImage
from tirl.cmodules import filestream as fs
def main():
# svs = TImage("/mnt/nvme/resources/NP015-15-CD68-20x.svs", level=0,
# storage="hdd")
# print(svs)
src = open("/mnt/nvme/temp/histo_veulz7ls", "rb")
dst = open("/mnt/nvme/temp/histo_exp.tmp", "rb+")
fs.copy_data(src, dst)
src.close()
dst.close()
if __name__ == "__main__":
main()
#!/usr/bin/env python3
from tirl.timage import TImage
from tirl.costs.mind import CostMIND
from tirl.transformations.linear import TxRotation2D
from sklearn.cluster import KMeans
# This script may also be a good way to show how much rotation-tolerant MIND is.
def main():
img = TImage("../tests/resources/testimg.png").reduce_tensors(copy=True)
mind = CostMIND.mind(CostMIND, img)
km = KMeans(n_clusters=8, random_state=0)
labels = km.fit_predict(mind.data.reshape(-1, 8)).reshape(img.vshape)
TImage.fromarray(labels).preview(cmap="jet")
# Same for a rotated image
img.centralise()
rot = TxRotation2D(15).apply(img)
mind = CostMIND.mind(CostMIND, rot)
km = KMeans(n_clusters=8, random_state=0)
labels = km.fit_predict(mind.data.reshape(-1, 8)).reshape(rot.vshape)
TImage.fromarray(labels).preview(cmap="jet")
if __name__ == "__main__":
main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment