naamiinepal / xrayto3D-benchmark

GNU General Public License v3.0
9 stars 3 forks source link

Projective Spatial Transformer: preliminary code explore #26

Open msrepo opened 1 year ago

msrepo commented 1 year ago

Quick setup and run https://github.com/gaocong13/Projective-Spatial-Transformers

RuntimeError: Subtraction, the - operator, with a bool tensor is not supported. If you are trying to invert a mask, use the ~ or logical_not() operator instead. from https://stackoverflow.com/questions/65637222/runtimeerror-subtraction-the-operator-with-a-bool-tensor-is-not-supported replace

mask_c0 = mask_d2 * mask_d0_d1
mask_c1 = mask_d2 * (1 - mask_d0_d1)
mask_c2 = (1 - mask_d2) * mask_d0_nd1
mask_c3 = (1 - mask_d2) * (1 - mask_d0_nd1)

with

mask_c0 = mask_d2 * mask_d0_d1
mask_c1 = mask_d2 * ~(mask_d0_d1)
mask_c2 = ~(mask_d2) * mask_d0_nd1
mask_c3 = ~(mask_d2) * ~(mask_d0_nd1) 
msrepo commented 1 year ago

Tasks

msrepo commented 1 year ago

Understand these predefined hard-coded geometry

    # Pre-defined hard coded geometry
    src_det = 1020
    iso_center = 400
    det_size = 128
    pix_spacing = 0.73 * 512 / det_size #0.194*1536 / det_size
    step_size = 1.75
    vol_size = CT_vol.shape[0]

    norm_factor = (vol_size * vol_spacing / 2)
    src = (src_det - iso_center) / norm_factor
    det = -iso_center / norm_factor
    pix_spacing = pix_spacing / norm_factor
    step_size = step_size / norm_factor

Normalizing factor: normalizes the input volume such that it occupies the normalized physical space (-1,1) image

msrepo commented 1 year ago

Expected: s0004_hip-ap Got: s0004_hip_projection Using Camera Parameters: image