Пример #1
0
    def __getitem__(self, ref_name):
        if ref_name not in self.keys():

            if ref_name not in self.references_list:
                warnings.warn(f"No reference named {ref_name} "
                              f"(available: {self.references_list})")
                return None

            self.data[ref_name] = read_tiff(self.data_path /
                                            f"{ref_name}.tiff")

        return self.data[ref_name]
Пример #2
0
    def hemispheres(self):
        if self._hemispheres is None:
            # If reference is symmetric generate hemispheres block:
            if self.metadata["symmetric"]:
                # initialize empty stack:
                stack = np.full(self.metadata["shape"], 2, dtype=np.uint8)

                # Use bgspace description to fill out with hemisphere values:
                front_ax_idx = self.space.axes_order.index("frontal")

                # Fill out with 2s the right hemisphere:
                slices = [slice(None) for _ in range(3)]
                slices[front_ax_idx] = slice(
                    stack.shape[front_ax_idx] // 2 + 1, None)
                stack[tuple(slices)] = 1

                self._hemispheres = stack
            else:
                self._hemispheres = read_tiff(self.root_dir /
                                              HEMISPHERES_FILENAME)
        return self._hemispheres
Пример #3
0
 def annotation(self):
     if self._annotation is None:
         self._annotation = read_tiff(self.root_dir / ANNOTATION_FILENAME)
     return self._annotation
Пример #4
0
 def reference(self):
     if self._reference is None:
         self._reference = read_tiff(self.root_dir / REFERENCE_FILENAME)
     return self._reference