Example #1
0
    def pipeline(self):

        args = self.parse_args()

        os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
        os.environ["CUDA_VISIBLE_DEVICES"] = str(args.gpu_num)

        from deepneuro.pipelines.Segment_GBM.predict import predict_GBM

        predict_GBM(args.output_folder,
                    args.T2,
                    args.T1,
                    args.T1POST,
                    args.FLAIR,
                    None,
                    args.input_directory,
                    bias_corrected=args.debiased,
                    resampled=args.resampled,
                    registered=args.registered,
                    skullstripped=args.skullstripped,
                    normalized=args.normalized,
                    save_preprocess=args.save_preprocess,
                    save_all_steps=args.save_all_steps,
                    output_wholetumor_filename=args.wholetumor_output,
                    output_enhancing_filename=args.enhancing_output)
Example #2
0
def test_glioblastoma_module(testing_directory="/home/DeepNeuro/tmp", gpu_num='0'):

    import numpy as np
    import os
    from shutil import rmtree

    FLAIR, T1POST, T1PRE = np.random.normal(loc=1000, scale=200, size=(240, 240, 40)), \
                            np.random.normal(loc=1500, scale=200, size=(240, 240, 180)), \
                            np.random.normal(loc=1300, scale=200, size=(120, 120, 60))

    from deepneuro.utilities.conversion import save_data

    try:
        os.mkdir(testing_directory)
        FLAIR_file = save_data(FLAIR, os.path.join(testing_directory, 'FLAIR.nii.gz'))
        T1PRE_file = save_data(T1PRE, os.path.join(testing_directory, 'T1PRE.nii.gz'))
        T1POST_file = save_data(T1POST, os.path.join(testing_directory, 'T1POST.nii.gz'))

        from deepneuro.pipelines.Segment_GBM.predict import predict_GBM

        os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
        os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_num)
        predict_GBM(testing_directory, 
                T1POST=T1POST_file, 
                FLAIR=FLAIR_file, 
                T1PRE=T1PRE_file)

        rmtree(testing_directory)

    except:
        rmtree(testing_directory)
        raise

    return
Example #3
0
    def pipeline(self):

        args = self.parse_args()

        os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
        os.environ["CUDA_VISIBLE_DEVICES"] = str(args.gpu_num)

        from deepneuro.pipelines.Segment_GBM.predict import predict_GBM

        predict_GBM(args.output_folder,
                    FLAIR=args.FLAIR,
                    T1POST=args.T1POST,
                    T1PRE=args.T1,
                    ground_truth=None,
                    bias_corrected=args.debiased,
                    registered=args.registered,
                    skullstripped=args.skullstripped,
                    preprocessed=args.preprocessed,
                    save_only_segmentations=args.save_only_segmentations,
                    output_probabilities=args.output_probabilities,
                    save_all_steps=args.save_all_steps,
                    output_wholetumor_filename=args.wholetumor_output,
                    output_enhancing_filename=args.enhancing_output,
                    quiet=args.quiet)
Example #4
0
        -registered: If flagged, data is assumed to already have been registered into the same space, and skips that preprocessing step.
        -save_all_steps: If flagged, intermediate volumes in between preprocessing steps will be saved in output_folder.
        -save_preprocessed: If flagged, the final volume after all preprocessing steps will be saved in output_folder
            ''')

    parser.add_argument('--output_folder', type=str)
    parser.add_argument('--T2', type=str)
    parser.add_argument('--T1', type=str)
    parser.add_argument('--T1POST', type=str)
    parser.add_argument('--FLAIR', type=str)
    parser.add_argument('--gpu_num', nargs='?', const='0', type=str)
    parser.add_argument('--debiased', action='store_true')  
    parser.add_argument('--resampled', action='store_true')
    parser.add_argument('--registered', action='store_true')
    parser.add_argument('--skullstripped', action='store_true') # Currently non-functional
    parser.add_argument('--normalized', action='store_true') 
    parser.add_argument('--save_preprocess', action='store_true')
    parser.add_argument('--save_all_steps', action='store_true')
    parser.add_argument('--ModelName', type=str)
    parser.add_argument('--Output_WholeTumor', type=str)
    parser.add_argument('--Output_EnhancingTumor', type=str)
    args = parser.parse_args(sys.argv[2:])
    #

    os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
    os.environ["CUDA_VISIBLE_DEVICES"] = str(args.gpu_num)

    from deepneuro.pipelines.Segment_GBM.predict import predict_GBM

    predict_GBM(args.output_folder, T2=args.T2, T1=args.T1, T1POST=args.T1POST, FLAIR=args.FLAIR, ground_truth=None, input_directory='/INPUT_DATA', bias_corrected=args.debiased, resampled=args.resampled, registered=args.registered, skullstripped=args.skullstripped, normalized=False, save_preprocess=False, save_all_steps=False, output_wholetumor_filename=args.Output_WholeTumor, output_enhancing_filename=args.Output_EnhancingTumor)