Code Monkey home page Code Monkey logo

Comments (14)

darcymason avatar darcymason commented on September 22, 2024 1

(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.

mrbean-bremen avatar mrbean-bremen commented on September 22, 2024

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.

mrbean-bremen avatar mrbean-bremen commented on September 22, 2024

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.

MohammadSalehi72 avatar MohammadSalehi72 commented on September 22, 2024

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.

mrbean-bremen avatar mrbean-bremen commented on September 22, 2024

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.

MohammadSalehi72 avatar MohammadSalehi72 commented on September 22, 2024

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.

mrbean-bremen avatar mrbean-bremen commented on September 22, 2024

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.

MohammadSalehi72 avatar MohammadSalehi72 commented on September 22, 2024

Sure, thank you for your support.

from pydicom.

darcymason avatar darcymason commented on September 22, 2024

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.

mrbean-bremen avatar mrbean-bremen commented on September 22, 2024

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.

scaramallion avatar scaramallion commented on September 22, 2024

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.

darcymason avatar darcymason commented on September 22, 2024
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.

scaramallion avatar scaramallion commented on September 22, 2024

I don't mind having a try at this

from pydicom.

mrbean-bremen avatar mrbean-bremen commented on September 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.