{"action":"created","issue":{"url":"https://api.github.com/repos/darcymason/pydicom/issues/193","labels_url":"https://api.github.com/repos/darcymason/pydicom/issues/193/labels{/name}","comments_url":"https://api.github.com/repos/darcymason/pydicom/issues/193/comments","events_url":"https://api.github.com/repos/darcymason/pydicom/issues/193/events","html_url":"https://github.com/darcymason/pydicom/pull/193","id":57206375,"number":193,"title":"Use the `force` to treat invalid values as 'OB' VR.","user":{"login":"samueljohn","id":725299,"avatar_url":"https://avatars.githubusercontent.com/u/725299?v=3","gravatar_id":"","url":"https://api.github.com/users/samueljohn","html_url":"https://github.com/samueljohn","followers_url":"https://api.github.com/users/samueljohn/followers","following_url":"https://api.github.com/users/samueljohn/following{/other_user}","gists_url":"https://api.github.com/users/samueljohn/gists{/gist_id}","starred_url":"https://api.github.com/users/samueljohn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samueljohn/subscriptions","organizations_url":"https://api.github.com/users/samueljohn/orgs","repos_url":"https://api.github.com/users/samueljohn/repos","events_url":"https://api.github.com/users/samueljohn/events{/privacy}","received_events_url":"https://api.github.com/users/samueljohn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-10T17:23:53Z","updated_at":"2015-02-10T19:49:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/darcymason/pydicom/pulls/193","html_url":"https://github.com/darcymason/pydicom/pull/193","diff_url":"https://github.com/darcymason/pydicom/pull/193.diff","patch_url":"https://github.com/darcymason/pydicom/pull/193.patch"},"body":"I need to be able to `force`-read DICOM data sets from the Xoran xCAT-ENT DVT scanner. That device seems to produce invalid dicoms, which nonetheless, I have to handle. In particular, the \"Exposure\" tag is set  to `\"57.6\"` but it is stored as an `IS` value representation. This leads to the exception\r\n\r\n```\r\ninvalid literal for int() with base 10: '57.6'\r\n```\r\n\r\nduring conversion of the raw value. This is triggered if I just investigate a dataset in IPython for example (because of the pretty printing that already causes the convert).\r\n\r\nThis PR is just a starting point. Take it as a suggestion. \r\nI pass `force` all the way down; starting from `read_file`\r\nover `Dataset` to `DataElement_from_raw`. In there, I imagine that the `ValueError` is caught and the fall back is to just treat the field as `'OB'`. \r\n\r\nI am not sure if this is the smartest approach. Suggestions welcome. \r\nWarning: I haven't run the test suite on this yet.\r\nIf you want a sample dcm file from that scanner, let me know."},"comment":{"url":"https://api.github.com/repos/darcymason/pydicom/issues/comments/73770227","html_url":"https://github.com/darcymason/pydicom/pull/193#issuecomment-73770227","issue_url":"https://api.github.com/repos/darcymason/pydicom/issues/193","id":73770227,"user":{"login":"cancan101","id":51059,"avatar_url":"https://avatars.githubusercontent.com/u/51059?v=3","gravatar_id":"","url":"https://api.github.com/users/cancan101","html_url":"https://github.com/cancan101","followers_url":"https://api.github.com/users/cancan101/followers","following_url":"https://api.github.com/users/cancan101/following{/other_user}","gists_url":"https://api.github.com/users/cancan101/gists{/gist_id}","starred_url":"https://api.github.com/users/cancan101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cancan101/subscriptions","organizations_url":"https://api.github.com/users/cancan101/orgs","repos_url":"https://api.github.com/users/cancan101/repos","events_url":"https://api.github.com/users/cancan101/events{/privacy}","received_events_url":"https://api.github.com/users/cancan101/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T19:49:18Z","updated_at":"2015-02-10T19:49:18Z","body":"The problem with any stop gap measure is that it sets the API indefinitely (i.e. do we really want to add `force` to all of these method signatures?)\r\n\r\nThis just seems arbitrary to me:\r\n```diff\r\n+    except ValueError as e:\r\n+        # normal convert failed, if `force` then try to read as \"OB\" at least\r\n+        if force:\r\n+            import warnings\r\n+            warnings.warn(\"Falling back to VR='OB' for {0} because: {1}\".\r\n+                          format(raw.tag, e))\r\n+            VR = 'OB'\r\n+            value = convert_value(VR, raw, encoding)\r\n+        else:\r\n+            raise e\r\n```\r\nwhy should `force` mean if there is a `ValueError` parse using the `OB` parser?\r\n"}}