cytometer/data.py
def write_path_to_aida_json_file(fp, x, hue=170, pretty_print=False):
    """
    DEPRECATED: Use aida_write_new_items() instead.
    Write single contour to a JSON file in AIDA's annotation format.

    (This function only writes the XML code only for the contour, not a full JSON file).

    :param fp: file pointer to text file that is open for writing/appending.
    :param x: numpy.ndarray with two columns, for (x,y)-coordinates of the points of a polygonal contour.
    :param hue: (def 170, which is a greenish blue) The hue of the color as a value in degrees between 0 and 360.
    :param pretty_print: (def False) Boolean. Whether to save the file with '\n' and whitespaces for pretty formatting.
    :return: None.
    """

    warnings.warn('Use aida_write_new_items() instead', DeprecationWarning)

    if pretty_print:
        fp.write('        {\n')
        fp.write('          "class": "",\n')
        fp.write('          "type": "path",\n')
        fp.write('          "color": {\n')
        fp.write('            "fill": {\n')
        fp.write('              "hue": ' + str(hue) + ',\n')
        fp.write('              "saturation": 0.44,\n')
        fp.write('              "lightness": 0.69,\n')
        fp.write('              "alpha": 0.5\n')
        fp.write('            },\n')
        fp.write('            "stroke": {\n')
        fp.write('              "hue": ' + str(hue) + ',\n')
        fp.write('              "saturation": 0.44,\n')
        fp.write('              "lightness": 0.69,\n')
        fp.write('              "alpha": 1.0\n')
        fp.write('            }\n')
        fp.write('          },\n')
        fp.write('          "segments": [\n')
        for i, pt in enumerate(x):
            fp.write('            [' + '{0:.12f}'.format(pt[0]) + ', ' + '{0:.12f}'.format(pt[1]))
            if i == len(x) - 1:
                fp.write(']\n')  # last point in the contour
            else:
                fp.write('],\n')  # any other point in the contour
        fp.write('          ],\n')
        fp.write('          "closed": true\n')
        fp.write('        }')
    else:
        fp.write('{')
        fp.write('"class": "",')
        fp.write('"type": "path",')
        fp.write('"color": {')
        fp.write('"fill": {')
        fp.write('"hue": ' + str(hue) + ',')
        fp.write('"saturation": 0.44,')
        fp.write('"lightness": 0.69,')
        fp.write('"alpha": 0.5')
        fp.write('},')
        fp.write('"stroke": {')
        fp.write('"hue": ' + str(hue) + ',')
        fp.write('"saturation": 0.44,')
        fp.write('"lightness": 0.69,')
        fp.write('"alpha": 1.0')
        fp.write('}')
        fp.write('},')
        fp.write('"segments": [')
        for i, pt in enumerate(x):
            fp.write('[' + '{0:.12f}'.format(pt[0]) + ',' + '{0:.12f}'.format(pt[1]))
            if i == len(x) - 1:
                fp.write(']')  # last point in the contour
            else:
                fp.write('],')  # any other point in the contour
        fp.write('],')
        fp.write('"closed": true')
        fp.write('}')

    return

    DEPRECATED: Use aida_write_new_items() instead.
    Write single contour to a JSON file in AIDA's annotation format.

    (This function only writes the XML code only for the contour, not a full JSON file).

    :param fp: file pointer to text file that is open for writing/appending.
    :param x: numpy.ndarray with two columns, for (x,y)-coordinates of the points of a polygonal contour.
    :param hue: (def 170, which is a greenish blue) The hue of the color as a value in degrees between 0 and 360.
    :param pretty_print: (def False) Boolean. Whether to save the file with '\n' and whitespaces for pretty formatting.
    :return: None.
    


(This function only writes the XML code only for the contour, not a full JSON file).
( This function only writes the XML code only for the contour not a full JSON file ) .
def write_path_to_aida_json_file(fp, x, hue=170, pretty_print=False):
    warnings.warn('Use aida_write_new_items() instead', DeprecationWarning)
    if pretty_print:
        fp.write('        {\n')
        fp.write('          "class": "",\n')
        fp.write('          "type": "path",\n')
        fp.write('          "color": {\n')
        fp.write('            "fill": {\n')
        fp.write('              "hue": ' + str(hue) + ',\n')
        fp.write('              "saturation": 0.44,\n')
        fp.write('              "lightness": 0.69,\n')
        fp.write('              "alpha": 0.5\n')
        fp.write('            },\n')
        fp.write('            "stroke": {\n')
        fp.write('              "hue": ' + str(hue) + ',\n')
        fp.write('              "saturation": 0.44,\n')
        fp.write('              "lightness": 0.69,\n')
        fp.write('              "alpha": 1.0\n')
        fp.write('            }\n')
        fp.write('          },\n')
        fp.write('          "segments": [\n')
        for i, pt in enumerate(x):
            fp.write('            [' + '{0:.12f}'.format(pt[0]) + ', ' + '{0:.12f}'.format(pt[1]))
            if i == len(x) - 1:
                fp.write(']\n')  
            else:
                fp.write('],\n')  
        fp.write('          ],\n')
        fp.write('          "closed": true\n')
        fp.write('        }')
    else:
        fp.write('{')
        fp.write('"class": "",')
        fp.write('"type": "path",')
        fp.write('"color": {')
        fp.write('"fill": {')
        fp.write('"hue": ' + str(hue) + ',')
        fp.write('"saturation": 0.44,')
        fp.write('"lightness": 0.69,')
        fp.write('"alpha": 0.5')
        fp.write('},')
        fp.write('"stroke": {')
        fp.write('"hue": ' + str(hue) + ',')
        fp.write('"saturation": 0.44,')
        fp.write('"lightness": 0.69,')
        fp.write('"alpha": 1.0')
        fp.write('}')
        fp.write('},')
        fp.write('"segments": [')
        for i, pt in enumerate(x):
            fp.write('[' + '{0:.12f}'.format(pt[0]) + ',' + '{0:.12f}'.format(pt[1]))
            if i == len(x) - 1:
                fp.write(']')  
            else:
                fp.write('],')  
        fp.write('],')
        fp.write('"closed": true')
        fp.write('}')
    return
def write_path_to_aida_json_file ( fp , x , hue = 170 , pretty_print = False ) : warnings . warn ( 'Use aida_write_new_items() instead' , DeprecationWarning ) if pretty_print : fp . write ( '        {\n' ) fp . write ( '          "class": "",\n' ) fp . write ( '          "type": "path",\n' ) fp . write ( '          "color": {\n' ) fp . write ( '            "fill": {\n' ) fp . write ( '              "hue": ' + str ( hue ) + ',\n' ) fp . write ( '              "saturation": 0.44,\n' ) fp . write ( '              "lightness": 0.69,\n' ) fp . write ( '              "alpha": 0.5\n' ) fp . write ( '            },\n' ) fp . write ( '            "stroke": {\n' ) fp . write ( '              "hue": ' + str ( hue ) + ',\n' ) fp . write ( '              "saturation": 0.44,\n' ) fp . write ( '              "lightness": 0.69,\n' ) fp . write ( '              "alpha": 1.0\n' ) fp . write ( '            }\n' ) fp . write ( '          },\n' ) fp . write ( '          "segments": [\n' ) for i , pt in enumerate ( x ) : fp . write ( '            [' + '{0:.12f}' . format ( pt [ 0 ] ) + ', ' + '{0:.12f}' . format ( pt [ 1 ] ) ) if i == len ( x ) - 1 : fp . write ( ']\n' ) else : fp . write ( '],\n' ) fp . write ( '          ],\n' ) fp . write ( '          "closed": true\n' ) fp . write ( '        }' ) else : fp . write ( '{' ) fp . write ( '"class": "",' ) fp . write ( '"type": "path",' ) fp . write ( '"color": {' ) fp . write ( '"fill": {' ) fp . write ( '"hue": ' + str ( hue ) + ',' ) fp . write ( '"saturation": 0.44,' ) fp . write ( '"lightness": 0.69,' ) fp . write ( '"alpha": 0.5' ) fp . write ( '},' ) fp . write ( '"stroke": {' ) fp . write ( '"hue": ' + str ( hue ) + ',' ) fp . write ( '"saturation": 0.44,' ) fp . write ( '"lightness": 0.69,' ) fp . write ( '"alpha": 1.0' ) fp . write ( '}' ) fp . write ( '},' ) fp . write ( '"segments": [' ) for i , pt in enumerate ( x ) : fp . write ( '[' + '{0:.12f}' . format ( pt [ 0 ] ) + ',' + '{0:.12f}' . format ( pt [ 1 ] ) ) if i == len ( x ) - 1 : fp . write ( ']' ) else : fp . write ( '],' ) fp . write ( '],' ) fp . write ( '"closed": true' ) fp . write ( '}' ) return
DEPRECATED: Use aida_write_new_items() instead.
DEPRECATED : Use aida_write_new_items () instead .
"""
    DEPRECATED: Use aida_write_new_items() instead.
    Write single contour to a JSON file in AIDA's annotation format.

    (This function only writes the XML code only for the contour, not a full JSON file).

    :param fp: file pointer to text file that is open for writing/appending.
    :param x: numpy.ndarray with two columns, for (x,y)-coordinates of the points of a polygonal contour.
    :param hue: (def 170, which is a greenish blue) The hue of the color as a value in degrees between 0 and 360.
    :param pretty_print: (def False) Boolean. Whether to save the file with '\n' and whitespaces for pretty formatting.
    :return: None.
    """ # last point in the contour # any other point in the contour # last point in the contour # any other point in the contour
None
fp
file pointer to text file that is open for writing/appending.
file pointer to text file that is open for writing / appending .
x
numpy.ndarray with two columns, for (x,y)-coordinates of the points of a polygonal contour.
numpy . ndarray with two columns for ( x y ) - coordinates of the points of a polygonal contour .
hue
(def 170, which is a greenish blue) The hue of the color as a value in degrees between 0 and 360.
( def 170 which is a greenish blue ) The hue of the color as a value in degrees between 0 and 360 .
pretty_print
(def False) Boolean. Whether to save the file with '\n' and whitespaces for pretty formatting.
( def False ) Boolean . Whether to save the file with ' \ n ' and whitespaces for pretty formatting .