Esempio n. 1
0
    def info(self, hdf_path, channel_name=None):
        """
        Print available information about HDF5 file, or specified channel.

        :param hdf_path: HDF5 file of interest
        :param channel_name: Print information only concerning specified channel.
        :return: None
        """

        if not os.path.isfile(hdf_path):
            sys.exit("File not found!")

        self.hdf_path = hdf_path
        lmf = LightMicroscopyHDF(self.hdf_path)

        if channel_name is not None:
            print lmf.get_channel(channel_name)
        else:
            print lmf

        lmf.close()
Esempio n. 2
0
    def write_affine(self, hdf_path, channel_name, affine_name, affine_path):
        """
        Reads ITK produced affine file and writes it in nifti and itk compatible formats to a given channel.

        :param hdf_path: path to the HDF5 file
        :param channel_name: Identifies the channel to which affine will be written.
        :param affine_name: Name of the affine, must be unique for channel.
        :param affine_path: Path to a .txt file containing the affine parameters.
        :return: None
        """
        self.hdf_path = hdf_path
        lmf = LightMicroscopyHDF(self.hdf_path)
        channel = lmf.get_channel(channel_name)
        channel.write_affine(affine_name, affine_path)
        lmf.close()