-
Notifications
You must be signed in to change notification settings - Fork 146
Conversation
interface/backend/api/views.py
Outdated
return s.replace(u"\u0000", "").strip() | ||
|
||
def _convert_value(self, v): | ||
t = type(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typical way to do this in Python is using isinstance
.
interface/backend/api/views.py
Outdated
cv = repr(v) | ||
return cv | ||
|
||
def dicom_dataset_to_dict(self, ds): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think Django has some kind of idea about a serializer? Perhaps we should extend support via that instead of these custom routines? Alternatively, we could extend Django's JSON serializer? Anyway I think we should have this in utils.py
or similar anyway :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Django Rest Framework Serializer: http://www.django-rest-framework.org/api-guide/serializers/
interface/backend/api/views.py
Outdated
Put dicom metadata into a separate dictionary | ||
''' | ||
dicom_dict = {} | ||
repr(ds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
interface/backend/api/tests.py
Outdated
'1.3.6.1.4.1.14519.5.2.1.6279.6001.490157381160200744295382098329/' \ | ||
'1.3.6.1.4.1.14519.5.2.1.6279.6001.619372068417051974713149104919/-80.750000.dcm"' | ||
}) | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to test for some specific metadata attributes that should be correct and are known for the image? Like SeriesInstanceUID?
a416ebb
to
66da2f2
Compare
interface/backend/api/views.py
Outdated
path = request.GET.get('dicom_location') | ||
if path is None: | ||
raise Exception('dicom_location not provided') | ||
path = path[1:-1] # un-quoting the string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hang on, why would we be quoted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Please clarify in docstring for posterity, not here....)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lamby unquoted path seems to create problem with existing url patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"seems to"?
And again, please clarify the reason in the docstring itself, otherwise these important comments just get lost :)
interface/backend/api/views.py
Outdated
''' | ||
path = request.GET.get('dicom_location') | ||
if path is None: | ||
raise Exception('dicom_location not provided') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't recommend raising Exception
- there is almost always a better one. Indeed, why not just do a raw request.GET
and let it KeyError
and — potentially — reraise it as a ValueError
. I mean, that's going to be far more useful to the callsite.
@rahit As I understand it, this is waiting on you? :) |
66da2f2
to
c22c00b
Compare
@lamby sorry for the late. |
Thanks! |
API implementation for dicom metadata and preview available at:
/api/images/metadata?dicom_location='IMAGE_PATH'
.Description
Before selecting particular DICOM image for analysis we need to display its metadata with preview. This API provides those data.
Reference to official issue
#33
How Has This Been Tested?
Test case to check HTTP 200 OK status for valid dicom image has been added. However, because of the issue #116, test cases are failing for the test images. I am adding screenshot which I verified using a dicom image from original dataset.
Screenshots (if appropriate):
CLA