我有一本字典,其中只有一行,其中约有15 key:value
个部分。我将其转换为
{
'Image Index':'00019089_001.png',
'Finding Labels':'Mass',
'Follow-up #':'1',
'Patient ID':'19089',
'Patient Age':'23',
'Patient Gender':'F',
'View Position':'PA',
'OriginalImage_Width':'2992',
'OriginalImage_Height':'2991',
'OriginalImagePixelSpacing_x':'0.143',
'OriginalImagePixelSpacing_y':'0.143',
'Clinician_Notes':'',
'Clinician_Date':'',
'Doctor_Review':'',
'Doctor_Review_Date':'',
'Image_View':'https://chest-xray-source-images.s3-us-west-2.amazonaws.com/image_store/00019089_001.png'
}
df = pd.DataFrame.from_dict(resp1, orient='index')
我无法在Dash的HTML表中显示此记录。
这是我的数据框。左列是标题,右列是数据。我需要能够在DIV的HTML表中显示数据,而在另一个DIV的图像中显示图像。
Image Index 00019089_001.png
Finding Labels Mass
Follow-up # 1
Patient ID 19089
Patient Age 23
Patient Gender F
View Position PA
OriginalImage_Width 2992
OriginalImage_Height 2991
OriginalImagePixelSpacing_x 0.143
OriginalImagePixelSpacing_y 0.143
Clinician_Notes
Clinician_Date
Doctor_Review
Doctor_Review_Date
Image_View https://chest-xray-source-images.s3-us-west-2....
这是我的模板中收到输入的代码:
tab_1_layout = html.Div([
html.H6('Search X-Ray by Image Index'),
dcc.Input(
id='ImageIndexInput',
value='',
type='text',
minLength=9,
maxLength=9,
size='25',
style={'color':cols['background'], 'text': cols['text']}
),
html.Div(id='image-file-input')
])
。
@app.callback(Output('image-file-input', 'children'),
[Input('ImageIndexInput', 'value')])
def image_file_input(input_value):
"""Function to retrieve one image's data from elasticseach."""
.
.
.
.
.
try:
resp = es.get(index=index, doc_type=doc_type, id=file_id)
resp1 = resp['_source']
resp1.update({'Image_View': s3_loc})
df = pd.DataFrame.from_dict(resp1, orient='index')
return [html.Tr(html.Th(i)) for i in df.columns ]
except: df = [{'error': 'Image not found'}]