SeiictyUsui / pydicom

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

DA, DT, TM converters #142

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
As suggested in discussion "TM, DA converters?" tags DA, DT, TM could be 
converted to datetime objects:
https://groups.google.com/forum/#!topic/pydicom/4IMwZiFgCkk

Original issue reported on code.google.com by Dimitri....@gmail.com on 19 Apr 2014 at 12:11

GoogleCodeExporter commented 8 years ago
Please find a proof-of-concept here:
https://code.google.com/r/dimitripapadopoulos-pydicom/source/detail?r=11dac0718e
ad057e40108337096c22f3c4d0b8a4

For now tested on a pair of DICOM files only. Just wanted some feedback before 
adding comments and testing more extensively.

Original comment by Dimitri....@gmail.com on 19 Apr 2014 at 12:16

GoogleCodeExporter commented 8 years ago
Significant additional dependencies:
re
dateutil.tz

Original comment by Dimitri....@gmail.com on 19 Apr 2014 at 12:17

GoogleCodeExporter commented 8 years ago
I have a new version with a dicom.config.datetime_conversion switch to toggle 
between previous behavior and conversion to datetime objects.

https://code.google.com/r/dimitripapadopoulos-pydicom/source/detail?r=92da991a40
5fa8c9e16c6147ba32160eeaacfdcb

Any additional changes?

Original comment by Dimitri....@gmail.com on 27 Apr 2014 at 1:10

GoogleCodeExporter commented 8 years ago
Looks good. Adding unit tests would be much appreciated, for some normal values 
and for some corner cases.  Also I didn't notice anything yet on the writing 
side -- the existing "round-trip" read/write unit tests (a couple of files 
maybe) could be copied to do tests with the config conversion on.

Original comment by darcymason@gmail.com on 29 Apr 2014 at 1:42

GoogleCodeExporter commented 8 years ago
I have added unit tests and documentation:
https://code.google.com/r/dimitripapadopoulos-pydicom/source/detail?r=7aa18b6607
82182d6e72564185f796abeae9ef52

Which are the "round-trip" read/write tests to run with the config conversion 
on?

Original comment by Dimitri....@gmail.com on 1 May 2014 at 10:44

GoogleCodeExporter commented 8 years ago
And by the way, I must admit I'm not sure what needs to be added on the writing 
side. A standalone function to create a data element from a datetime object? 
But that's not in the filewriter code, is t?

Original comment by Dimitri....@gmail.com on 1 May 2014 at 1:16

GoogleCodeExporter commented 8 years ago
I seldom use the part of pydicom that writes DICOM files. I've spent a few 
hours on it  and I think I have understood enough of it:
- to add a test by merely inheriting WriteFileTests,
- to fix dataelem.py so that DA, DT, TM data elements are still created as 
strings if datetime_conversion is not set.

I'm not sure I'm doing the right thing when it comes to initializing data 
elements from datetime objects - see the __new__() method of DA, DT, TM classes.

Original comment by Dimitri....@gmail.com on 2 May 2014 at 8:19

GoogleCodeExporter commented 8 years ago
Hi Dimitri,
I've had a look through the code and everything looks good.  I'll pull it into 
my local clone and go through it in more detail.

Original comment by darcymason@gmail.com on 7 May 2014 at 1:37

GoogleCodeExporter commented 8 years ago
What ever came of this patch / addition?

Original comment by agrothberg on 9 Nov 2014 at 9:09