@@ -21,17 +21,17 @@ def get_apr(image, rel_error=0.1, gradient_smoothing=2, verbose=True, params=Non
2121 else :
2222 par = params
2323
24- if image .dtype in ( 'float' , ' float32' ) :
24+ if image .dtype == np . float32 :
2525 parts = pyapr .FloatParticles ()
2626 converter = pyapr .converter .FloatConverter ()
27- elif image .dtype in ( 'short' , ' uint16' ) :
27+ elif image .dtype == np . uint16 :
2828 parts = pyapr .ShortParticles ()
2929 converter = pyapr .converter .ShortConverter ()
3030 # elif image.dtype in {'byte', 'uint8'}: # currently not working
3131 # parts = pyapr.ByteParticles()
3232 # converter = pyapr.converter.ByteConverter()
3333 else :
34- errstr = 'get_apr_interactive image dtype must be one of (float, float32, short, uint16) , ' \
34+ errstr = 'pyapr.converter.get_apr: input image dtype must be numpy.uint16 or numpy. float32, ' \
3535 'but {} was given' .format (image .dtype )
3636 raise TypeError (errstr )
3737
@@ -68,17 +68,17 @@ def get_apr_interactive(image, rel_error=0.1, gradient_smoothing=2, verbose=True
6868 else :
6969 par = params
7070
71- if image .dtype in ( 'float' , ' float32' ) :
71+ if image .dtype == np . float32 :
7272 parts = pyapr .FloatParticles ()
7373 converter = pyapr .converter .FloatConverter ()
74- elif image .dtype in ( 'short' , ' uint16' ) :
74+ elif image .dtype == np . uint16 :
7575 parts = pyapr .ShortParticles ()
7676 converter = pyapr .converter .ShortConverter ()
7777 # elif image.dtype in {'byte', 'uint8'}: # currently not working
7878 # parts = pyapr.ByteParticles()
7979 # converter = pyapr.converter.ByteConverter()
8080 else :
81- errstr = 'pyapr.converter.get_apr_interactive: image dtype must be one of (float, float32, short, uint16) , ' \
81+ errstr = 'pyapr.converter.get_apr_interactive: input image dtype must be numpy.uint16 or numpy. float32, ' \
8282 'but {} was given' .format (image .dtype )
8383 raise TypeError (errstr )
8484
@@ -122,14 +122,14 @@ def find_parameters_interactive(image, rel_error=0.1, gradient_smoothing=0, verb
122122 else :
123123 par = params
124124
125- if image .dtype in ( 'float' , ' float32' ) :
125+ if image .dtype == np . float32 :
126126 converter = pyapr .converter .FloatConverter ()
127- elif image .dtype in ( 'short' , ' uint16' ) :
127+ elif image .dtype == np . uint16 :
128128 converter = pyapr .converter .ShortConverter ()
129129 # elif image.dtype in {'byte', 'uint8'}: # currently not working
130130 # converter = pyapr.converter.ByteConverter()
131131 else :
132- errstr = 'find_parameters_interactive image. dtype must be one of (float, float32, short, uint16) , ' \
132+ errstr = 'pyapr.converter. find_parameters_interactive: input image dtype must be numpy.uint16 or numpy. float32, ' \
133133 'but {} was given' .format (image .dtype )
134134 raise TypeError (errstr )
135135
0 commit comments