Exemplo n.º 1
0
def make_afterCHIR_CD11_myPGC(main_path, well_image):
    # main_path: r'D:\CD11'
    # well_image: specific image path

    if not os.path.exists(main_path):
        print('!ERROR! The main_path does not existed!')
        return False
    if not os.path.exists(well_image):
        print('!ERROR! The well_image does not existed!')
        return False

    folder_MyPGC_img = 'MyPGC_img'

    if os.path.exists(well_image):
        t_path_list = os.path.split(
            well_image
        )  # [r'D:\pro\CD22\SSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
        t1_path_list = os.path.split(
            t_path_list[0])  # [r'D:\pro\CD22\SSS_100%', 'S1']
        t2_path_list = os.path.split(
            t1_path_list[0])  # [r'D:\pro\CD22', 'SSS_100%']
        SSS_folder = t2_path_list[1]  # 'SSS_100%'
        S_index = t1_path_list[1]  # 'S1'
        S = int(S_index.split('S')[1])  # 1
        img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
        name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'
        T = int(name_index.split('~T')[1])  # 1
        if name_index.find('IPS') >= 0:
            E = 1
        else:
            E = 2

        print('>>>', S_index, '---', name_index,
              ' Image MyPGC Enhancement :::')
        to_file = os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                               S_index, img_name)
        if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
            os.makedirs(os.path.join(main_path, folder_MyPGC_img))
        if not os.path.exists(
                os.path.join(main_path, folder_MyPGC_img, SSS_folder)):
            os.makedirs(os.path.join(main_path, folder_MyPGC_img, SSS_folder))
        if not os.path.exists(
                os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                             S_index)):
            os.makedirs(
                os.path.join(main_path, folder_MyPGC_img, SSS_folder, S_index))

        image_my_PGC(well_image, to_file)
        call_matlab_FC(main_path,
                       to_file,
                       E,
                       T,
                       S,
                       result_path='FractalCurving',
                       this_async=True,
                       do_curving_now=False,
                       sleep_s=0)

    return True
Exemplo n.º 2
0
def make_afterCHIR10_CD13_myPGC(main_path, well_image):
    if not os.path.exists(main_path):
        print('!ERROR! The main_path does not existed!')
        return False
    if not os.path.exists(well_image):
        print('!ERROR! The well_image does not existed!')
        return False

    # folder_Enhanced_img = 'Enhanced_img'
    folder_MyPGC_img = 'MyPGC_img'
    afterCHIR10_CD13 = [
        '2018-11-30~IPS-3_CD13~T18', '2018-12-01~I-1_CD13~T1',
        '2018-12-01~I-1_CD13~T2', '2018-12-01~I-1_CD13~T3',
        '2018-12-01~I-1_CD13~T4', '2018-12-01~I-1_CD13~T5',
        '2018-12-01~I-1_CD13~T6', '2018-12-01~I-1_CD13~T7',
        '2018-12-01~I-1_CD13~T8', '2018-12-01~I-1_CD13~T9',
        '2018-12-01~I-1_CD13~T10'
    ]

    # if len(well_image) == 2:
    #     pass
    # else:
    #     return False

    if os.path.exists(well_image):
        t_path_list = os.path.split(
            well_image
        )  # [r'D:\pro\CD22\SSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
        t1_path_list = os.path.split(
            t_path_list[0])  # [r'D:\pro\CD22\SSS_100%', 'S1']
        t2_path_list = os.path.split(
            t1_path_list[0])  # [r'D:\pro\CD22', 'SSS_100%']
        SSS_folder = t2_path_list[1]  # 'SSS_100%'
        S_index = t1_path_list[1]  # 'S1'
        img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
        name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'

        if name_index in afterCHIR10_CD13:
            print('>>>', S_index, '---', name_index,
                  ' Image MyPGC Enhancement :::')
            to_file = os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
                os.makedirs(os.path.join(main_path, folder_MyPGC_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index))
            image_my_PGC(well_image, to_file)

    return True
Exemplo n.º 3
0
def make_afterCHIR10_CD27_myPGC(main_path, well_image):
    # main_path: r'M:\CD27\PROCESSING'
    # well_image: specific image path r'M:\CD27\PROCESSING\SSS_100%\S2\2019-06-22~CD27_stageI_0h~T6.png'
    if not os.path.exists(main_path):
        print('!ERROR! The main_path does not existed!')
        return False
    if not os.path.exists(well_image):
        print('!ERROR! The well_image does not existed!')
        return False

    folder_MyPGC_img = 'MyPGC_img'
    afterCHIR10_CD27 = [
        '2019-06-22~CD27_IPS(H9)~T1', '2019-06-22~CD27_stageI_0h~T1',
        '2019-06-22~CD27_stageI_0h~T2', '2019-06-22~CD27_stageI_0h~T3',
        '2019-06-22~CD27_stageI_0h~T4', '2019-06-22~CD27_stageI_0h~T5',
        '2019-06-22~CD27_stageI_0h~T6', '2019-06-22~CD27_stageI_0h~T7',
        '2019-06-22~CD27_stageI_0h~T8', '2019-06-22~CD27_stageI_0h~T9',
        '2019-06-22~CD27_stageI_0h~T10'
    ]

    if os.path.exists(well_image):
        t_path_list = os.path.split(
            well_image
        )  # [r'D:\pro\CD22\SSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
        t1_path_list = os.path.split(
            t_path_list[0])  # [r'D:\pro\CD22\SSS_100%', 'S1']
        t2_path_list = os.path.split(
            t1_path_list[0])  # [r'D:\pro\CD22', 'SSS_100%']
        SSS_folder = t2_path_list[1]  # 'SSS_100%'
        S_index = t1_path_list[1]  # 'S1'
        img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
        name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'

        if name_index in afterCHIR10_CD27:
            print('>>>', S_index, '---', name_index,
                  ' Image MyPGC Enhancement :::')
            to_file = os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
                os.makedirs(os.path.join(main_path, folder_MyPGC_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index))
            image_my_PGC(well_image, to_file)

    return True
Exemplo n.º 4
0
def make_afterCHIR_CD41_myPGC(main_path, well_image):
    # main_path: r'H:\CD41\PROCESSING'
    # well_image: specific image path

    if not os.path.exists(main_path):
        print('!ERROR! The main_path does not existed!')
        return False
    if not os.path.exists(well_image):
        print('!ERROR! The well_image does not existed!')
        return False

    folder_MyPGC_img = 'MyPGC_img'
    afterCHIR_CD41 = [
        '2020-01-16~CD41_IPS~T1', '2020-01-16~CD41_STAGEI_1H~T1',
        '2020-01-16~CD41_STAGEI_1H~T2', '2020-01-16~CD41_STAGEI_1H~T3',
        '2020-01-16~CD41_STAGEI_1H~T4', '2020-01-16~CD41_STAGEI_1H~T5',
        '2020-01-16~CD41_STAGEI_1H~T6', '2020-01-16~CD41_STAGEI_1H~T7',
        '2020-01-16~CD41_STAGEI_1H~T8', '2020-01-16~CD41_STAGEI_1H~T9',
        '2020-01-16~CD41_STAGEI_1H~T10', '2020-01-16~CD41_STAGEI_1H~T11',
        '2020-01-16~CD41_STAGEI_1H~T12', '2020-01-16~CD41_STAGEI_1H~T13',
        '2020-01-16~CD41_STAGEI_1H~T14', '2020-01-16~CD41_STAGEI_1H~T15',
        '2020-01-16~CD41_STAGEI_1H~T16', '2020-01-16~CD41_STAGEI_1H~T17',
        '2020-01-16~CD41_STAGEI_1H~T18', '2020-01-16~CD41_STAGEI_1H~T19',
        '2020-01-16~CD41_STAGEI_1H~T20', '2020-01-16~CD41_STAGEI_1H~T21',
        '2020-01-16~CD41_STAGEI_1H~T22', '2020-01-16~CD41_STAGEI_1H~T23',
        '2020-01-16~CD41_STAGEI_1H~T24', '2020-01-16~CD41_STAGEI_1H~T25'
    ]

    if os.path.exists(well_image):
        t_path_list = os.path.split(
            well_image
        )  # [r'D:\pro\CD22\SSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
        t1_path_list = os.path.split(
            t_path_list[0])  # [r'D:\pro\CD22\SSS_100%', 'S1']
        t2_path_list = os.path.split(
            t1_path_list[0])  # [r'D:\pro\CD22', 'SSS_100%']
        SSS_folder = t2_path_list[1]  # 'SSS_100%'
        S_index = t1_path_list[1]  # 'S1'
        img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
        name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'

        if name_index in afterCHIR_CD41:
            print('>>>', S_index, '---', name_index,
                  ' Image MyPGC Enhancement :::')
            to_file = os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
                os.makedirs(os.path.join(main_path, folder_MyPGC_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index))
            image_my_PGC(well_image, to_file)

    return True
Exemplo n.º 5
0
def main(args):
    # this program can extraction cell density(1) and SIFT features(256) of one M
    global main_path, well_image

    main_path = args.main_path  # r'D:\pro\CD22'
    well_image = []
    well_image.append(args.well_image_0)
    well_image.append(args.well_image_1)
    folder_Enhanced_img = 'Enhanced_img'
    folder_MyPGC_img = 'MyPGC_img'

    if not os.path.exists(main_path):
        print('!ERROR! The main_path does not existed!')
        return False

    if len(well_image) == 1:

        if os.path.exists(well_image[0]):
            t_path_list = os.path.split(
                well_image[0]
            )  # [r'D:\pro\CD22\SSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
            t1_path_list = os.path.split(
                t_path_list[0])  # [r'D:\pro\CD22\SSS_100%', 'S1']
            t2_path_list = os.path.split(
                t1_path_list[0])  # [r'D:\pro\CD22', 'SSS_100%']
            SSS_folder = t2_path_list[1]  # 'SSS_100%'
            S_index = t1_path_list[1]  # 'S1'
            img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
            name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'

            print('>>>', S_index, '---', name_index, ' Image Enhancement :::')

            # do something :::
            # 1.image_my_enhancement()
            # 2.image_my_PGC()

            img_file = well_image[0]

            to_file = os.path.join(main_path, folder_Enhanced_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path,
                                               folder_Enhanced_img)):
                os.makedirs(os.path.join(main_path, folder_Enhanced_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder,
                                 S_index))
            image_my_enhancement(img_file, to_file)

            to_file = os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
                os.makedirs(os.path.join(main_path, folder_MyPGC_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index))
            image_my_PGC(img_file, to_file)

    elif len(well_image) == 2:

        if os.path.exists(well_image[0]):
            t_path_list = os.path.split(
                well_image[0]
            )  # [r'D:\pro\CD22\SSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
            t1_path_list = os.path.split(
                t_path_list[0])  # [r'D:\pro\CD22\SSS_100%', 'S1']
            t2_path_list = os.path.split(
                t1_path_list[0])  # [r'D:\pro\CD22', 'SSS_100%']
            SSS_folder = t2_path_list[1]  # 'SSS_100%'
            S_index = t1_path_list[1]  # 'S1'
            img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
            name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'

            print('>>>', S_index, '---', name_index, ' Image Enhancement :::')

            # do something :::
            # 1.image_my_enhancement()
            # 2.image_my_PGC()

            img_file = well_image[0]

            to_file = os.path.join(main_path, folder_Enhanced_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path,
                                               folder_Enhanced_img)):
                os.makedirs(os.path.join(main_path, folder_Enhanced_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_Enhanced_img, SSS_folder,
                                 S_index))
            image_my_enhancement(img_file, to_file)

            to_file = os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
                os.makedirs(os.path.join(main_path, folder_MyPGC_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSS_folder,
                                 S_index))
            image_my_PGC(img_file, to_file)

        if os.path.exists(well_image[1]):
            t_path_list = os.path.split(
                well_image[1]
            )  # [r'D:\pro\CD22\SSSS_100%\S1', '2018-11-28~IPS_CD13~T1.jpg']
            t1_path_list = os.path.split(
                t_path_list[0])  # [r'D:\pro\CD22\SSSS_100%', 'S1']
            t2_path_list = os.path.split(
                t1_path_list[0])  # [r'D:\pro\CD22', 'SSSS_100%']
            SSSS_folder = t2_path_list[1]  # 'SSSS_100%'
            S_index = t1_path_list[1]  # 'S1'
            img_name = t_path_list[1]  # '2018-11-28~IPS_CD13~T1.png'
            name_index = img_name[:-4]  # '2018-11-28~IPS_CD13~T1'

            print('>>>', S_index, '---', name_index, ' Feature Extraction :::')

            # do something :::
            # 0.core_features()
            # 1.image_my_enhancement()
            # 2.core_features()
            # 3.image_my_PGC()
            # 4.core_features()

            img_file = well_image[1]

            sigle_features(main_path, img_file, result_path='Analysis')

            to_file = os.path.join(main_path, folder_Enhanced_img, SSSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path,
                                               folder_Enhanced_img)):
                os.makedirs(os.path.join(main_path, folder_Enhanced_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_Enhanced_img, SSSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_Enhanced_img, SSSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_Enhanced_img, SSSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_Enhanced_img, SSSS_folder,
                                 S_index))
            image_my_enhancement(img_file, to_file)
            sigle_features(main_path, to_file, result_path='Enhanced_Analysis')

            to_file = os.path.join(main_path, folder_MyPGC_img, SSSS_folder,
                                   S_index, img_name)
            if not os.path.exists(os.path.join(main_path, folder_MyPGC_img)):
                os.makedirs(os.path.join(main_path, folder_MyPGC_img))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSSS_folder)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSSS_folder))
            if not os.path.exists(
                    os.path.join(main_path, folder_MyPGC_img, SSSS_folder,
                                 S_index)):
                os.makedirs(
                    os.path.join(main_path, folder_MyPGC_img, SSSS_folder,
                                 S_index))
            image_my_PGC(img_file, to_file)
            sigle_features(main_path, to_file, result_path='MyPGC_Analysis')

        return True

    return False