Comments (14)
(something like "get_testdata_file does not support absolute paths, it only works with internal pydicom test data - did you mean 'dcmread'?").
Sounds good ... except since get_testdata_file only returns the filename and there will be a dcmread anyway, perhaps spell out the passed absolute path: ...f"did you mean 'dcmread({name})'?"
Also, I have been thinking if it is a good idea in general to use
get_testdata_file
in the example code so prominently, as people tend to copy/paste code from the examples without checking the documentation
I've thought this too, but having runnable examples out of the box is very helpful too. I think with a clearer error message it would be much less of a problem.
from pydicom.
Your file seems to have a private SOP class ID (1.2.246.352.70.2.1.160.3), so pydicom will probably not know how to handle this. What is your error message?
(BTW: there is no "support" 😀 - just people maintaining pydicom in their free time)
from pydicom.
Ok, I just checked - the private SOP Class is not a problem, you should be able to read the waveform data just fine.
Please share the code you used and the callstack of the error.
from pydicom.
Ok, I just checked - the private SOP Class is not a problem, you should be able to read the waveform data just fine.
Please share the code you used and the callstack of the error.
Dear mrbean,
Thank you for your response. I understand that the previous issue was my fault. However, I like to have a some plot like: https://pydicom.github.io/pydicom/stable/_images/waveforms_encode.png from data stored into file.
from pydicom.
I think I see what you did: you used get_testdata_file
instead of dcmread
. get_testdata_file
is only there to get testdata from pydicom itself - you need to use dcmread
for custom DICOM files instead.
from pydicom.
Hi, You're right. I used get_testdata_file instead of dcmread. Actually, the sample file I've attached previously is a VARIAN RPM data for a motion phantom. I think it should have a pattern of movement for 6 degree of freedom, and I'm looking a way to plot them separately.
from pydicom.
Ok, I know nothing about that data, but now that you are able to read the data you can probably go ahead with your project. Feel free to ask if you encounter any pydicom-related problems.
from pydicom.
Sure, thank you for your support.
from pydicom.
I wonder if we should capture this NotImplementedError
from glob and re-raise with a more helpful message (including reference to dcmread
); it is very cryptic message in this case. Alternatively (and perhaps more future-proof if Path.glob
ever changes behavior or raises a different exception), could check the pattern with Path(pattern).is_absolute()
and raise our own error.
from pydicom.
Yes, exactly - I have been thinking along the same lines (something like "get_testdata_file does not support absolute paths, it only works with internal pydicom test data - did you mean 'dcmread'?").
Also, I have been thinking if it is a good idea in general to use get_testdata_file
in the example code so prominently, as people tend to copy/paste code from the examples without checking the documentation. This specific problem already came up too many times, both on GitHub and SO. I haven't looked thought of a better way though, so...
from pydicom.
I've toyed with the idea of doing something similar to (I think) scikit-image, where we have an examples
module and the example DICOM datasets can be fetched with
from pydicom.examples import ct_small
May need some niceness to avoid having the datasets loaded into memory
from pydicom.
from pydicom.examples import ct_small
I like it. And I think we discussed something similar ... sometime...
May need some niceness to avoid having the datasets loaded into memory
Since Python 3.7 one can define __getattr__
for modules, so could load only specifically requested ones. __getattr__
could do the get_testdata_file
, dcmread
, and return the dataset, throwing an AttributeError
if the name is not a correct pydicom test file.
I think we'll have to keep get_testdata_file
etc. around for a while anyway for backwards compat. But it would be nice to get them out of example code.
from pydicom.
I don't mind having a try at this
from pydicom.
I like it, too. I had been thinking about some "internal" module but didn't like it, but "examples" is much better, and I like the way it will be used.
from pydicom.
Related Issues (20)
- Change Python formatting: black → ruff HOT 2
- Intermittent test failures HOT 2
- Comparing two codes where one is erroneously set as a SRT will throw KeyError
- Add support for encoding JPEG2000 and JPEG-LS
- ValueError: cannot reshape array of size HOT 13
- GDCM fails to decode JPEG-LS pixel data with bits stored 6 or 7 HOT 1
- Decoding failure for JPEG-LS pixel data when pixel representation is 1 and bits stored is less than bits allocated
- Decoding failure for JPEG-LS when Bits Allocated is 16 and Bit Stored <= 8 HOT 1
- The (0028,0101) 'Bits Stored' value (16-bit) doesn't match the JPEG 2000 data (14-bit) HOT 3
- Compressing PixelData does not change the VR from OW to OB HOT 1
- dicom saved can't match the plt.show HOT 1
- can pydicom realize dicom image registration HOT 1
- Return sequence items as a list? HOT 3
- Dataset decompress function does not update length of the pixel data HOT 2
- deepcopy on dataset with private block fails HOT 1
- Convenience function to get existing UID instance by string HOT 2
- Inconsistent color-space in `pixel_array` decompressed with `pylibjpeg` vs `gdcm` HOT 4
- Remaining Pixel Data work HOT 6
- Pillow unable to decode 9-bit J2K images correctly HOT 1
- Invoking pixel_array truncates valid data if NumberOfFrames is not defined HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pydicom.