ndio/remote/ndingest.py
def identify_imagesize(self, image_type, image_path='/tmp/img.'):
        """
        Identify the image size using the data location and other parameters
        """
        dims = ()
        try:
            if (image_type.lower() == 'png'):
                dims = np.shape(ndpng.load('{}{}'.format(
                    image_path, image_type
                )))
            elif (image_type.lower() == 'tif' or image_type.lower() == 'tiff'):
                dims = np.shape(ndtiff.load('{}{}'.format(
                    image_path, image_type
                )))
            else:
                raise ValueError("Unsupported image type.")
        except:
            raise OSError('The file was not accessible at {}{}'.format(
                image_path,
                image_type
            ))
        return dims[::-1]
def identify_imagesize(self, image_type, image_path='/tmp/img.'):
        """
        Identify the image size using the data location and other parameters
        """
        dims = ()
        try:
            if (image_type.lower() == 'png'):
                dims = np.shape(ndpng.load('{}{}'.format(
                    image_path, image_type
                )))
            elif (image_type.lower() == 'tif' or image_type.lower() == 'tiff'):
                dims = np.shape(ndtiff.load('{}{}'.format(
                    image_path, image_type
                )))
            else:
                raise ValueError("Unsupported image type.")
        except:
            raise OSError('The file was not accessible at {}{}'.format(
                image_path,
                image_type
            ))
        return dims[::-1]
def identify_imagesize ( self , image_type , image_path = '/tmp/img.' ) : dims = ( ) try : if ( image_type . lower ( ) == 'png' ) : dims = np . shape ( ndpng . load ( '{}{}' . format ( image_path , image_type ) ) ) elif ( image_type . lower ( ) == 'tif' or image_type . lower ( ) == 'tiff' ) : dims = np . shape ( ndtiff . load ( '{}{}' . format ( image_path , image_type ) ) ) else : raise ValueError ( "Unsupported image type." ) except : raise OSError ( 'The file was not accessible at {}{}' . format ( image_path , image_type ) ) return dims [ : : - 1 ]
Identify the image size using the data location and other parameters
Identify the image size using the data location and other parameters