diff --git a/README.md b/README.md index faebfb6..6e0c19b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Library for opening [ISS](https://iss.com) files and their conversion to tiff. ## Installation - pip install git+https://github.com/wimpomp/issfile.git + pip install issfile ## Converting .iss-pt files to .tiff files @@ -11,8 +11,8 @@ Library for opening [ISS](https://iss.com) files and their conversion to tiff. iss2tiff file.iss-pt -this will create file.tiff and file.carpet.tiff containing images and carpets respectively. -Metadata is also saved in the tiffs in the description tag. +this will create file.tif and file.carpet.tif containing images and carpets respectively. +Metadata is also saved in the tiffs in the description tag. A pdf with some plots is created too. ## Use as a library diff --git a/issfile/__init__.py b/issfile/__init__.py index 3658128..606192f 100644 --- a/issfile/__init__.py +++ b/issfile/__init__.py @@ -53,7 +53,7 @@ class TiffFile(IJTiffFile): class IssFile: - def __init__(self, file, version=388): + def __init__(self, file, version=416): self.file = file self.version = version self.zip = ZipFile(self.file) @@ -122,20 +122,25 @@ class IssFile: frame_bytes = self.shape[0] * self.shape[1] * self.delta data, metadata = [], [] self.data.seek(frame * frame_bytes) - for i in range(int(1000 * self.time_interval / self.cycle_time)): + cycles = int(1000 * self.time_interval / self.cycle_time) + for i in range(cycles): line = [unpack('= 388: metadata.append(unpack('= 416: + index = np.argsort(metadata[0]) + index = index[metadata[0, index] > 0] + else: + index = np.zeros(int(round(max(metadata[0]) / self.cycle_time)) + 1, int) + for i, j in enumerate(metadata[0]): + index[int(round(j / self.cycle_time)) - 1] = i + index = index[metadata[0, index] > 0] + metadata[0] += self.get_carpet_t0(t, cycles) + return data[index], metadata[:, index] def get_carpet_t0(self, t, cycles=None): if t + 1 > len(self._carpet_t0): @@ -214,8 +219,8 @@ class IssFile: def main(): parser = ArgumentParser(description='Convert .iss-pt files into .tiff files.') parser.add_argument('files', help='files to be converted', nargs='*') - parser.add_argument('-v', '--version', type=int, default=388, - help='version of VistaVision with which the .iss-pt was written, default: 388') + parser.add_argument('-v', '--version', type=int, default=416, + help='version of VistaVision with which the .iss-pt was written, default: 416') args = parser.parse_args() for file in [Path(file) for files in args.files for file in glob(files)]: diff --git a/setup.py b/setup.py index 4333d22..6a3e170 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import os import setuptools -version = '2022.12.1' +version = '2023.2.0' with open('README.md', 'r') as fh: long_description = fh.read()