Ejemplo n.º 1
0
    print('Original Image Spacing ', image3D.GetSpacing())
    print('Original Image Size ', image3D.GetSize())

    orig_size = image3D.GetSize()
    orig_spacing = image3D.GetSpacing()
    min_orig = min(orig_spacing)
    max_orig = max(orig_spacing)

    if max_orig > 50:
        print(
            'Error: File ', select,
            ' may have extra dicom file, move -0001 to another folder, try again',
            '\n')
        exit()

    image3D_resample_seq = resample_itk_image.resample_img(
        image3D, [min_orig, min_orig, min_orig])

    print('Resampled Image Spacing For Sequential ',
          image3D_resample_seq.GetSpacing())
    print('Resampled Image Size For Sequential',
          image3D_resample_seq.GetSize())

    # recast types as necessary for analysis

    start_time = time.time()

    seg = sitk.BinaryThreshold(image3D_resample_seq,
                               lowerThreshold=lower_threshold,
                               upperThreshold=upper_threshold,
                               insideValue=1,
                               outsideValue=0)
Ejemplo n.º 2
0
    reader = sitk.ImageFileReader()
    reader.SetFileName(series_file_names[0])
    #reader.LoadPrivateTagsOn();

    reader.ReadImageInformation()

    print('Original Image Spacing ', image3D.GetSpacing())
    print('Original Image Size ', image3D.GetSize())

    orig_size = image3D.GetSize()
    orig_spacing = image3D.GetSpacing()
    min_orig = min(orig_spacing)
    max_orig = max(orig_spacing)
    intermed_spacing = 2.0

    image3D_resample = resample_itk_image.resample_img(
        image3D, [intermed_spacing, intermed_spacing, intermed_spacing])

    print('Resampled Image Spacing ', image3D_resample.GetSpacing())
    print('Resampled Image Size ', image3D_resample.GetSize())

    image3D_resample_seq = resample_itk_image.resample_img(
        image3D, [min_orig, min_orig, min_orig])

    print('Resampled Image Spacing For Sequential ',
          image3D_resample_seq.GetSpacing())
    print('Resampled Image Size For Sequential',
          image3D_resample_seq.GetSize())

    # recast types as necessary for analysis

    recast_image3D = sitk.Cast(sitk.RescaleIntensity(image3D_resample),