diff --git a/mu_map/tmp/vis.py b/mu_map/tmp/vis.py deleted file mode 100644 index acc8b82a7057626da836b42567dced389905945c..0000000000000000000000000000000000000000 --- a/mu_map/tmp/vis.py +++ /dev/null @@ -1,42 +0,0 @@ -import argparse -import os - -import cv2 as cv -import numpy as np -import pydicom - -from interfile2dicom import read_interfile - -def to_gray(img, _min, _max): - _img = (img - _min) / (_max - _min) - _img = (_img * 255).astype(np.uint8) - _scale = 512 / img.shape[0] - _img = cv.resize(_img, None, fx=_scale, fy=_scale) - return _img - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("image", type=str) - args = parser.parse_args() - - _, ext = os.path.splitext(args.image) - - if ext == ".dcm": - img = pydicom.dcmread(args.image) - img = img.pixel_array / img[0x00331038].value - else: - img, _ = read_interfile(args.image) - - i = 0 - timeout = 100 - while True: - _img = to_gray(img[i], img.min(), img.max()) - _img = cv.putText(_img, str(i), (0, 30), cv.FONT_HERSHEY_SIMPLEX, 1, 255, 3) - i = (i + 1) % img.shape[0] - - cv.imshow("Proj", _img) - key = cv.waitKey(timeout) - if key == ord("q"): - break - elif key == ord("p"): - timeout = 0 if timeout > 0 else 100