Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible error in dcm_write #85

Open
Dale-Black opened this issue Feb 24, 2022 · 5 comments
Open

Possible error in dcm_write #85

Dale-Black opened this issue Feb 24, 2022 · 5 comments

Comments

@Dale-Black
Copy link
Contributor

Dale-Black commented Feb 24, 2022

I wrote this out on Zulip but I realized this might actually be a bug in dcm_write the more I am looking into it

Any idea why a tag (0x005e, 0x0040) is being created after creating a DICOM file using dcm_write when the original DICOM file used in dcm_write doesn't contain the previously mentioned tag?

@notZaki
Copy link
Member

notZaki commented Feb 25, 2022

It could be a bug.

What were the types for array and file? The dcm_write function doesn't currently do any sanity checks, so a possible reason could be that the replaced values don't have the same type as the old PixelData and InstanceNumber values.

@Dale-Black
Copy link
Contributor Author

It looks like it does have something to do with the dcm[tag"Pixel Data"] = array operation. When I comment out that line, the code runs fine and I can indeed write that to a new DICOM file and then load it using dcm_parse. I don't think it's the array type that is causing problems though since they have the same types. Could it be a problem with replacing the original Pixel Data with a different size array for the new Pixel Data?

image

@notZaki
Copy link
Member

notZaki commented Mar 1, 2022

Yup, the Rows and Columns fields will have to be updated if the size is different. I can never remember which of these should be 440 and which should be 640. Maybe see which combination gives a proper looking image.

@Dale-Black
Copy link
Contributor Author

That solved it

dcm[tag"Rows"] = size(array, 1)
dcm[tag"Columns"] = size(array, 2)

@Dale-Black
Copy link
Contributor Author

I am guessing there is a way to check for something like this when using dcm_write so if I ever get enough time I will try to create a PR to do just that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants