Skip to content

Commit

Permalink
Adding covid detector
Browse files Browse the repository at this point in the history
  • Loading branch information
prahalad12345 committed Jul 9, 2021
1 parent f99e06d commit ddbbf46
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Binary file added export.pkl
Binary file not shown.
2 changes: 1 addition & 1 deletion yadv.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
def main():
# YaDV Application setup
st.header("YaDV - Yet Another DICOM Viewer")
icon = Image.open('./images/YaDV.png')
icon = Image.open('./images/YADV.png')
st.sidebar.image(icon, caption="Yet another DICOM Viewer")
st.sidebar.title("YaDV - Options")

Expand Down
12 changes: 6 additions & 6 deletions yadv_3ddicom_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def threedVisulaization():
if(imagelist[i].Modality!='CT'):
st.error('This section is for CT images')
return
imagee=getpixelhu(imagelist)
pixresampled,spacing = resample(imagee,imagelist,[1,1,1])
imagee=getPixelHounsFieldUnit(imagelist)
pixresampled,spacing = resampleDICOMImage(imagee,imagelist,[1,1,1])

v,f=make_mesh(pixresampled,350,2)
v,f=create3dMesh(pixresampled,350,2)
dict={"Plot 3d":plt_3d,"Interactive 3d":plotly_3d}
if type_name == "Plot 3d" :
st.pyplot(dict[type_name](v,f))
Expand All @@ -80,7 +80,7 @@ def threedVisulaization():
# Output expected UnboundLocalErrors.
st.error("error")

def getpixelhu(scans):
def getPixelHounsFieldUnit(scans):
image=np.stack([files.pixel_array for files in scans])

image=image.astype(np.int16)
Expand All @@ -97,7 +97,7 @@ def getpixelhu(scans):

return np.array(image , dtype=np.int16)

def resample(image, scan, new_spacing=[1,1,1]):
def resampleDICOMImage(image, scan, new_spacing=[1,1,1]):
# Determine current pixel spacing
spacing = np.array([scan[0].SliceThickness] + (list)(scan[0].PixelSpacing), dtype=np.float32)
resize_factor = spacing / new_spacing
Expand All @@ -110,7 +110,7 @@ def resample(image, scan, new_spacing=[1,1,1]):

return image, new_spacing

def make_mesh(image, threshold=-300, step_size=1):
def create3dMesh(image, threshold=-300, step_size=1):
p = image.transpose(2,1,0)
verts, faces, norm, val = measure.marching_cubes(p, threshold, step_size=step_size, allow_degenerate=True)
return verts, faces
Expand Down

0 comments on commit ddbbf46

Please sign in to comment.