marksgraham / OCT-Converter

Tools for extracting the raw optical coherence tomography (OCT) and fundus data from proprietary file formats.
https://pypi.org/project/oct-converter/
MIT License
193 stars 70 forks source link

e2e file reading quantity problem #126

Closed Jackiecs3 closed 10 months ago

Jackiecs3 commented 10 months ago

hi mark

I am not a pure software engineer, so it is relatively difficult to solve these problems. I hope you can help me.

I used this command(pip install git+https://github.com/marksgraham/OCT-Converter) to obtain the latest code But when I read the e2e file, I found that the number of files was incorrect, and the actual number obtained was less than the expected number。

I uploaded the files I used.

My code content is as follows:

`import json

from oct_converter.readers import E2E filepath = "data/01003-od.e2e" file = E2E(filepath) oct_volumes = file.read_oct_volume()

for volume in oct_volumes: volume.peek(showcontours=True) # plots a montage of the volume volume.save("{}{}.png".format(volume.volume_id, volume.laterality)) print(volume.sex) volume.sex = 'U' print(volume.sex)

fundus_images = ( file.read_fundus_image() ) # returns a list of all fundus images with additional metadata if available for image in fundus_images:

plt.imshow(image.image)

#plt.show()
image.save("{}+{}.jpg".format(image.image_id, image.laterality))

metadata = file.read_all_metadata() with open("metadata.json", "w") as outfile: outfile.write(json.dumps(metadata, indent=4))`

I obtained data:

image
marksgraham commented 10 months ago

Hi there,

How many fundus/en-face images do you expect to be in the file? It looks like 6 are extracted.

BTW, I edited your post to remove the link to data in case the data is non-anonymised and shouldn't be in the public domain, but I have the link now so can take a look if needs be.

Jackiecs3 commented 10 months ago

Hi there,

How many fundus/en-face images do you expect to be in the file? It looks like 6 are extracted.

BTW, I edited your post to remove the link to data in case the data is non-anonymised and shouldn't be in the public domain, but I have the link now so can take a look if needs be.

Hi mark,

Nice to see your reply

I tried again a few times and found that this code didn't work. The bold part I added。

for volume in oct_volumes: volume.peek(showcontours=True) # plots a montage of the volume volume.save("{}{}.png".format(volume.volume_id, volume.laterality)) print(volume.sex) volume.sex = 'U' print(volume.sex)

fundus_images = ( file.read_fundus_image() ) # returns a list of all fundus images with additional metadata if available for image in fundus_images:

plt.imshow(image.image)

plt.show()

image.save("{}+{}.jpg".format(image.image_id, image.laterality))

metadata = file.read_all_metadata() with open("metadata.json", "w") as outfile: outfile.write(json.dumps(metadata, indent=4))`

But in fact, there is relevant data, about 40-50 sheets.

Can you use the data I uploaded last time to try and obtain the data in this file, and ultimately, how much data can be output?

I mainly want to obtain this part of data, not just fundus data

marksgraham commented 10 months ago

Sorry I've actually not got the link anyone - could you email it to me? (my email is on my github profile)

Oli4 commented 10 months ago

It might be possible to read such an e2e file with eyepy. This section in the documentation might help: https://medvisbonn.github.io/eyepy/formats/he_e2e/#access-other-data-stored-in-e2e-files

I could also have look myself.

Jackiecs3 commented 10 months ago

Sorry I've actually not got the link anyone - could you email it to me? (my email is on my github profile)

I have sent the data file via email to the address markgraham539@gmail.com, please check it. Thanks

marksgraham commented 10 months ago

It looks like there are some repeat scans in the file that get overwritten. I have added an option to not overwrite them. To access you will need to clone the repository and install by changing into the cloned directory and installing with pip install .

you can then use the new arg:

fundus_images = (
    file.read_fundus_image(extract_scan_repeats=True)
)

Curious if you've come accross this before @Oli4 ?

Jackiecs3 commented 10 months ago

It looks like there are some repeat scans in the file that get overwritten. I have added an option to not overwrite them. To access you will need to clone the repository and install by changing into the cloned directory and installing with pip install .

you can then use the new arg:

fundus_images = (
    file.read_fundus_image(extract_scan_repeats=True)
)

Curious if you've come accross this before @Oli4 ?

Continue using this instruction to obtain the latest code? pip install git+https://github.com/marksgraham/OCT-Converter

marksgraham commented 10 months ago

Continue using this instruction to obtain the latest code? pip install git+https://github.com/marksgraham/OCT-Converter

Yes that should work

Oli4 commented 10 months ago

It looks like there are some repeat scans in the file that get overwritten. I have added an option to not overwrite them. To access you will need to clone the repository and install by changing into the cloned directory and installing with pip install .

you can then use the new arg:

fundus_images = (
    file.read_fundus_image(extract_scan_repeats=True)
)

Curious if you've come accross this before @Oli4 ?

Hi @marksgraham,

thank you for the mention, I am aware that E2E files can contain multiple volumes or enfaces images. The Reader in eyepy should make them accessible. It also has an inspect method to give an overview of the files contents.

from eyepy.io import HeE2eReader

with HeE2eReader("filename.E2E") as e2e_reader:
    print(e2e_reader.inspect(iterative=True)) # 
Jackiecs3 commented 10 months ago

Continue using this instruction to obtain the latest code? pip install git+https://github.com/marksgraham/OCT-Converter

Yes that should work

Hi Mark,

Firstly, thank you for your support. After running the code you corrected, I can read and retrieve all the data.

This project, through my personal use these days, I believe it is a very good and valuable project in the field of ophthalmology. At the same time, it also provided me with a lot of help, such as reading files in formats such as e2e and fds.

I will use this project for a long time. If I encounter any problems in the future, I will communicate with you in a timely manner. I sincerely hope that this project can become better and better.

Yesterday, through my own use, I encountered several problems. 1、I can obtain all the fundus data now, but can the number of files output in dicom format be consistent with images?

image

2、About outputting dicom file label information. oct-converter output dicom file tag

Regarding the label pixel spacing, it should appear in the level 1 directory, currently at level 3

image

Correct example

image

How is the content of this field generated?? At present, if measurements are made based on this parameter, the data is clearly incorrect! 300mm should be bigger than one eye

image

This is my own data, and the dicom tags comply with the specifications and the values are normal. The following figure shows the measurement results

image

3、 About dicom tag Correct example Condition: (0002,0003) Media Storage SOP Instance UID == (0008,0018) SOP Instance UID

image

current results

image

The above is my feedback content

marksgraham commented 10 months ago

Hi,

Thanks for the feedback for the new dicom save feature. Could I ask you re-post these dicom issues on a new issue so its easier to keep track of?

Jackiecs3 commented 10 months ago

Hi,

Thanks for the feedback for the new dicom save feature. Could I ask you re-post these dicom issues on a new issue so its easier to keep track of?

ok new issues https://github.com/marksgraham/OCT-Converter/issues/128