google-code-export / pydicom

Automatically exported from code.google.com/p/pydicom
0 stars 0 forks source link

Setting is_little_endian and is_implicit_VR does not set file_meta.TransferSyntaxUID #157

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If I call:
    ds.is_little_endian = True
    ds.is_implicit_VR = True

and then I try to read:
ds.file_meta.TransferSyntaxUID

I get the following exception:
AttributeError: Dataset does not have attribute 'TransferSyntaxUID'.

This means that I cannot create a DICOM file in memory and then pass it to 
pynetdicom for sending (assuming that my code using pynetdicom reads the 
file_meta.TransferSyntaxUID).

Original issue reported on code.google.com by agrothberg on 10 Nov 2014 at 5:58

GoogleCodeExporter commented 9 years ago
This might be the same issue referred to here: 
https://code.google.com/p/pydicom/source/browse/source/dicom/examples/write_new.
py#64

Original comment by agrothberg on 10 Nov 2014 at 6:01

GoogleCodeExporter commented 9 years ago
As a rule, pydicom does not "connect" different data elements (or in this case, 
flags for transfer syntax to data elements).  It is up to the user to set all 
appropriate dicom data elements.  This might change in some future version, but 
DICOM is so complex in its requirements it would be very difficult to fulfill 
them (or warn) on behalf of the user for most situations.   The write_new 
program you linked does provide an example of how to set the elements.

As for pynetdicom, I'm not sure I understand the issue there ... you can set 
ds.file_meta.TransferSyntaxUID in memory before calling pynetdicom code.

Original comment by darcymason@gmail.com on 11 Nov 2014 at 8:48

GoogleCodeExporter commented 9 years ago
The issue is that If i set:
    ds.is_little_endian = True
    ds.is_implicit_VR = True
and then try to read:
    ds.file_meta.TransferSyntaxUID
I get an error.

If instead, i set:
    ds.is_little_endian = True
    ds.is_implicit_VR = True
save the file as XXXX.dcm. Then load XXXX.dcm and then read:
    ds.file_meta.TransferSyntaxUID
I can properly read that value. In other words,  round-tripping the DICOM to 
disk changes ds.file_meta.TransferSyntaxUID

Original comment by agrothberg on 11 Nov 2014 at 8:50