pylidc
is a python library intended to improve workflow associated with the LIDC dataset.
Install via pip: pip install pylidc
.
An object relational mapping for the LIDC dataset using sqlalchemy.
Home Page: https://pylidc.github.io
License: Other
pylidc
is a python library intended to improve workflow associated with the LIDC dataset.
Install via pip: pip install pylidc
.
Annotation(id=3761,scan_id=516) has internalStructure 5 which should not be greater than 4.
I checked the xml file of LIDC-IDRL-0516, there are only three <internalStructure>1</internalStructure>
tag.
here is the code
import pylidc as pl
anno = pl.query(pl.Annotation).filter(pl.Annotation.id==3761).first()
print(anno.internalStructure)
print(anno.InternalStructure)
5
Backend TkAgg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
File "C:\Users\p-c\.conda\envs\pylidc\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\p-c\.conda\envs\pylidc\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\p-c\.vscode\extensions\ms-python.python-2022.6.0\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module> cli.main()
File "c:\Users\p-c\.vscode\extensions\ms-python.python-2022.6.0\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\p-c\.vscode\extensions\ms-python.python-2022.6.0\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Users\p-c\.conda\envs\pylidc\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\p-c\.conda\envs\pylidc\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\p-c\.conda\envs\pylidc\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "I:\ywt\igniteTorch\test1.py", line 5, in <module>
print(anno.InternalStructure)
File "C:\Users\p-c\.conda\envs\pylidc\lib\site-packages\pylidc\Annotation.py", line 214, in InternalStructure
assert s in range(1,5), "Internal structure score out of bounds."
AssertionError: Internal structure score out of bounds.
python version
Python 3.8.18
pylidc 0.2.3
Hi, I am doing lung nodule predictions on the LIDC-IDRI-0069 sample, and I got the center and the size of the nodule detection to be
"center": [-59.54512023925781, 84.96267700195313, 1369.8218994140625],
"orientation": [-1.0, -0.0, -0.0, -0.0, -1.0, -0.0, 0.0, 0.0, 1.0],
"size": [9.868255615234377, 10.00336456298828, 19.705078125],
I am pretty sure that this lung nodule location corresponds to the first annotation, which is the one available if I run
pid = 'LIDC-IDRI-0069'
annotations = pl.query(pl.Annotation).filter(pl.Scan.patient_id == pid).first()
print("centre>>", annotations.centroid) => [169.19642857, 360.81122449, 46.20153061]
If I convert back to the real-world coordinate:
The following is the metadata
Spacing: [0.741, 0.741, 2.0] (in millimeters)
Origin (RAS): [184.3750, 188.2812, 1288.5]
169 * 0.741-184 = -58,
360 * 0.741-188=78,
46 * 2 + 1288.5 = 1380.5
This actually very much matches the coordinates provided by my prediction, however, I am adding the origin z value while I am minusing the origin x, y value in order to reproduce the value I predicted
This is not consistent, may I know is this formula correct?
I try to check on the second and third lungs nodules in the sample to cross check but I didn't find a way to get the second and third lung nodule annotations. I use this method from poe to get the second lung nodule but It doesn't seem right
pid = 'LIDC-IDRI-0069'
scan = pl.query(pl.Scan).filter(pl.Scan.patient_id == pid).first()
Query annotations for that specific scan
annotations = pl.query(pl.Annotation).filter(pl.Annotation.scan_id == scan.id).all()
second_annotation = annotations[1]
Hi,
I'm working on the LIDC-IDRI dataset and your tool is really convenient, thanks a lot.
I wanted to know if the current pylidc.sqlite
is up-to-date since the collection has been updated recently (2/24/2020)?
thanks
Hello, when I try to use scan.visualize i keep getting this error:
Loading dicom files ... This may take a moment.
Traceback (most recent call last):
File "pylidc_test.py", line 6, in
scan.visualize(annotation_groups=nodules)
File "C:\Users\hbrum\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pylidc\Scan.py", line 542, in visualize
for cell in scan_info_table.properties()['child_artists']:
KeyError: 'child_artists'
Hi,
I would like to know if there's any part of the codes I can change to concentrate on annotated non-nodules by the radiologist on the LIDC dataset? The idea is to preprocess these non-nodules as crops alongside with the nodules. Would appreciate if I could get some help on this.
Hey,
I'd like to continue my post from #9 here since it appears to me to be a real issue.
I'd expect bbox() to enclose an annotation in a cuboid.
However, from my POV this appears to be not the case:
import matplotlib.pyplot as plt
import numpy as np
import pylidc as pl
from matplotlib.widgets import Slider
def cube_show_slider(cube, axis=2, is_mask=False, **kwargs):
"""
Display a 3d ndarray with a slider to move along the third dimension.
Extra keyword arguments are passed to imshow
(Kudos to http://nbarbey.github.io/2011/07/08/matplotlib-slider.html)
"""
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
# check dim
if not cube.ndim == 3:
raise ValueError("cube should be an ndarray with ndim == 3")
# generate figure
fig = plt.figure()
subplot = fig.add_subplot(111)
fig.subplots_adjust(left=0.25, bottom=0.25)
if is_mask:
im1 = subplot.imshow(cube[:, :, 0])
fig.colorbar(im1)
else:
# select first image
s = [slice(0, 1) if i == axis else slice(None) for i in range(3)]
im = cube[s].squeeze()
# display image
l = subplot.imshow(im, **kwargs)
# define slider
axcolor = 'lightgoldenrodyellow'
ax = fig.add_axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor)
slider = Slider(ax, 'Axis %i index' % axis, 0, cube.shape[axis] - 1, valinit=0, valfmt='%i')
def update(val):
if is_mask:
subplot.imshow(cube[:, :, int(val)])
fig.canvas.draw()
else:
ind = int(slider.val)
s = [slice(ind, ind + 1) if i == axis else slice(None)
for i in range(3)]
im = cube[s].squeeze()
l.set_data(im, **kwargs)
fig.canvas.draw()
slider.on_changed(update)
plt.show()
def display_training_pair(input_cube, output_cube, axis=2, **kwargs):
# check dims
if not input_cube.ndim == 3 or not output_cube.ndim == 3:
raise ValueError("cube should be an ndarray with ndim == 3")
# generate figure
fig = plt.figure()
subplot_input = fig.add_subplot(221)
subplot_output = fig.add_subplot(222)
fig.subplots_adjust(left=0.25, bottom=0.25)
# select first image
im1 = subplot_output.imshow(output_cube[:, :, 0])
fig.colorbar(im1)
s = [slice(0, 1) if i == axis else slice(None) for i in range(3)]
im = input_cube[s].squeeze()
# display image
l = subplot_input.imshow(im, **kwargs)
# define slider
axcolor = 'lightgoldenrodyellow'
ax = fig.add_axes([0.25, 0.1, 0.65, 0.03], axisbg=axcolor)
slider = Slider(ax, 'Axis %i index' % axis, 0, input_cube.shape[axis] - 1, valinit=0, valfmt='%i')
def update(val):
subplot_output.imshow(output_cube[:, :, int(val)])
ind = int(slider.val)
s = [slice(ind, ind + 1) if i == axis else slice(None)
for i in range(3)]
im = input_cube[s].squeeze()
l.set_data(im, **kwargs)
fig.canvas.draw()
slider.on_changed(update)
plt.show()
if __name__ == '__main__':
scan = pl.query(pl.Scan).filter(pl.Scan.patient_id == 'LIDC-IDRI-0001').first()
Z_RANGE = 340 # (from -340 to 0)
SLICES = 133
scan_volume = scan.to_volume()
scan_volume_mask = np.zeros(scan_volume.shape)
an = scan.annotations[0]
an_box = an.bbox()
z_start = int((Z_RANGE + an_box[2, 0]) / Z_RANGE * SLICES)
z_end = int((Z_RANGE + an_box[2, 1]) / Z_RANGE * SLICES)
scan_volume_mask[int(an_box[0, 0]):int(an_box[0, 1]),
int(an_box[1, 0]):int(an_box[1, 1]),
int(z_start):int(z_end)] = 1
print("Expected outcome when mask is applied to lung image:")
vol, seg = an.uniform_cubic_resample(49)
cube_show_slider(vol * seg, is_mask=True)
print("Current outcome:")
display_training_pair(scan_volume, scan_volume_mask)
cube_show_slider(scan_volume * scan_volume_mask, is_mask=True)
... produces the correct expected result when the binary mask is applied to the data (here using uniform_cubic_resample
):
but one can see that the binary mask positioned using the bbox() coordinates is not at the exact same position as the annotation
which becomes even clearer when the mask is applied to the data and the annotation is not included in the masked image
Am I doing something wrong?
All I want is a binary image whose pixels are 1 if there is a cancerous annotation and otherwise 0 while the image shape is the same as the one of scan.to_volume()
.
The package is sorely lacking in unit testing
Hi,
I am working on this library from Google Colab. I know how to add a path from Google Colab. But where do I have to mention the respective path in the Scan Class?
Also, I have categorized negative and positive images under the same hierarchy of LIDC, e.g.
/content/drive/My Drive/LIDC-IDRI-0001/01-01-2000-30178/3000566-03192/Positive/000003
Its not working!
Following the instructions and example here: https://pylidc.github.io/tuts/scan.html#scan-visualization, the result is a static image, not interactive visualization.
See demo of the actual behavior here: https://www.screencast.com/t/kSNVqyRP1Rt
When the configuration file .pylidrc
doesn't exist, a warning message is printed. This message should be printed only initially and the configuration file created automatically with warn
set to False
.
I wanted to re-generate the database to include some additional attributes (#12 is a side-effect of trying to do that), but ran into this error:
$ python populate.py
Traceback (most recent call last):
File "populate.py", line 70, in <module>
pl._session.add(pl._Configuration(key='path_to_dicom_files', value=dicom_root_path))
AttributeError: module 'pylidc' has no attribute '_Configuration'
Was pl._Configuration
left out by mistake?
Hi, I had a question about how to go through a patient with multiple nodules. For example, I can see the first nodule of patient #1 and each annotation mask/slice to go along with it, but if patient 1 has multiple nodules each with different annotations is there any way I can check that?
Precisely, if a patient has more than 1 nodule, how would I know they have more than 1 and be able to access the other nodules? Thank you.
The root folder is not accessible in colab, so how do I access the configuration file to edit it? Should I create the file?
Keep receiving the same error: "RuntimeError: Could not establish path to dicom files. Have you specified the path
option in the configuration file /root/.pylidcrc?"
Hello, I'm trying to use pylidc for another database of images that I have. Therefore, I've edited populate.py to populate the database with my image data, and edited the .conf file. However after running populate.py successfully, it doesn't seem to have any effect as pl.query(pl.Scan) still pulls up the old list of patients ("LIDC-IDRI-xxxx"). Do I need to do anything else besides editing populate.py?
In 'matplotlib version == 3.6.2'
matplotlib.cm.cmap_d is not working in visualize_in_3d of Annotation.py code.
Just change the matplotlib.cm.cmap_d --> matplotlib.cm.cmaps_listed, and can use this.
I just wanted to update that I've successfully used pylidc on Window 8 with python 3.5.
The analogous location for .pylidcrc is C:\Users\[User]\.pylidcrc
. There is a minor issue with windows not allowing to creating a file with an empty filename (starting with a dot). The simple workaround is to add another dot in the end of the filename: .pylidcrc.
.
Reading the annotated XML file document from the LIDC-IDRI collection page, it says the following:
signifies beginning of region of interest description roi is a boundary describing either:
(a) a single voxel for nodules < 3 mm
(b) a complete contour of the nodule that describes the first voxel just outside the nodule.
I am hopefully missing something, but I cannot find the place in the code where the fact that the XML-defined contour is outside the nodule is accounted for. It looks like in pylidc the points of the contour are treated as those that are inside the nodule.
Would be great if it could be confirmed whether the contour points are not considered part of the nodule.
Hi,
I noticed the following metadata in LIDC-IDRI-0132/1.3.6.1.4.1.14519.5.2.1.6279.6001.218658642102832118810712329678/1.3.6.1.4.1.14519.5.2.1.6279.6001.151647338241909635299641922057/000000.dcm
:
[0040,0275] RequestAttributesSequence SQ 94
[fffe,e000] Item na 78
[0040,0007] ScheduledProcedureStepDescription CT, CHEST, W CONTRAST LO 22
It's writtent W CONTRAST
, yet pylidc returns contrast_used == False
.
I think pylidc is correct since there's not Contrast/Bolus Agent
dicom field, but i'm not sure...
any opinion?
thanks
If a user specifies a non-existent DICOM path in the pylidc config file, an error message is shown. This error message would be more helpful if it included the DICOM path that cannot be located from the config file:
Lines 209 to 215 in 20beb61
Thanks for your very useful library!
Would it make sense to automatically install sqlalchemy as well when pylidc is beeing installed?
Update: when installing dependencies using pip install -r requirements.txt
, one gets the error ModuleNotFoundError: No module named 'sqlalchemy'
which isn't even resolved when putting sqlalchemy
ahead of pylidc
.
Hello
Thanks for this nice software!
In the LIDC dataset the contours are created from different radiologists.. Approximately 4 have independently annotated the nodules
In order to construct more reliable segmentations /contours it is necessary to discriminate which annotator has annotated the nodules. Is it possible to retrieve information the information about which contours belong to a specific annotator (1,2,3,4)?
When plotting scans, annotations or contours, plotting functions expect a 000000.dcm
file when LIDC-IRC dataset does not have them.
Bug related to plotting methods: scan.visualize()
, ann.visualize_in_scan()
and ann.visualize_in_3d()
Error trace:
FileNotFoundError Traceback (most recent call last)
in ()
1 ann = pl.query(pl.Annotation).first()
----> 2 vol, seg = ann.uniform_cubic_resample(side_length = 100)
3 print(vol.shape, seg.shape)
4 # => (101, 101, 101) (101, 101, 101)
5/home/plexadmin/.virtualenvs/data-science-bowl-2017/lib/python3.5/site-packages/pylidc/Annotation.py in uniform_cubic_resample(self, side_length, verbose)
750
751 # Load the images. Get the z positions.
--> 752 images = self.scan.load_all_dicom_images(verbose=verbose)
753 img_zs = [float(img.ImagePositionPatient[-1]) for img in images]
754 img_zs = np.unique(img_zs)/home/plexadmin/.virtualenvs/data-science-bowl-2017/lib/python3.5/site-packages/pylidc/Scan.py in load_all_dicom_images(self, verbose)
308 images = []
309 for dicom_file_name in sorted_fnames:
--> 310 with open(os.path.join(path, dicom_file_name), 'rb') as f:
311 images.append( dicom.read_file(f) )
312 return imagesFileNotFoundError: [Errno 2] No such file or directory: '~/lidc_idri/data/LIDC/DOI/LIDC-IDRI-0078/1.3.6.1.4.1.14519.5.2.1.6279.6001.339170810277323131167631068432/1.3.6.1.4.1.14519.5.2.1.6279.6001.303494235102183795724852353824/000000.dcm'
@notmatthancock I was (again) reading this paper, and came across the example shown below (Fig.8):
Armato et al. The Lung Image Database Consortium (LIDC) and Image Database Resource Initiative (IDRI): a completed reference database of lung nodules on CT scans. Med. Phys. 38, 915โ931 (2011). https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3041807/
What is expected from the clustering of annotations into nodules, as implemented in pylidc, in this situation? I do not know which case was used in that illustration, so cannot quickly check what is actually happening.
This question might be stupid. is it possible to access NBIA? If then how can I do it?
https://www.cancerimagingarchive.net/nbia-search/?CollectionCriteria=LIDC-IDRI
running qu.all() shows all the id's for 97 patients, but the LIDC dataset has over 1000 patients. Is there an easy way to incorporate the others?
I tried to extract 200 patient annotations and dicoms. However the pl.query gets very slow after a few loops
Sorry if this is a dumb question but I'm just getting started with Pylidc and I'm having trouble using the Annotation class to get the masks of different LIDC scans.
The code says
ann = pl.query(pl.Annotation).first()
but as far as I can tell, this only gets the scan for the LIDC-0078 data. How would I modify this to run the scan for other LIDC data? Using .filter(Patient ID) does not work either. Thank you
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pylidc/Scan.py", line 644, in to_volume
for x in images
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pylidc/Scan.py", line 644, in <listcomp>
for x in images
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1716, in pixel_array
self.convert_pixel_data()
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1435, in convert_pixel_data
self._convert_pixel_data_without_handler()
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1545, in _convert_pixel_data_without_handler
raise last_exception
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1525, in _convert_pixel_data_without_handler
self._do_pixel_data_conversion(handler)
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/dataset.py", line 1554, in _do_pixel_data_conversion
arr = handler.get_pixeldata(self)
File "/home/lungsegment/virtualenv/medic/lib/python3.7/site-packages/pydicom/pixel_data_handlers/numpy_handler.py", line 317, in get_pixeldata
.format(actual_length, padded_expected_len)
ValueError: The length of the pixel data in the dataset (524285 bytes) doesn't match the expected length (524288 bytes). The dataset may be corrupted or there may be an issue with the pixel data handler.
This error encounter when I try to convert LIDC-IDRI-0401
to numpy array
This issue is sort of a follow up for the problem that was mentioned in pull-request #5 (similiar to issue #2)
In short:
Some of the .dcm files are missing (not only 0000.dcm), which results in an error.
I checked with the LIDC online access to make sure that the problem isn't the result of failed downloads:
1009
, where all files are present, but the first index is 3. Or patient 0777
, where all 187 files are present but start at number 5.0048
, the missing file (298) is the last one, but the total number of files is again consistant with the online dataset (297).At the time, it seemed to me that some of the missing files were in the middle. However, I don't see any such cases in my log.
Code:
scan= pl.query(pl.Scan).filter(pl.Scan.series_instance_uid == '1.3.6.1.4.1.14519.5.2.1.6279.6001.250863365157630276148828903732' ).first() scan.annotations[0].uniform_cubic_resample(side_length = 100)
Error:
Loading dicom files ... This may take a moment.
FileNotFoundError Traceback (most recent call last)
in ()
----> 1 scan.annotations[0].uniform_cubic_resample(side_length = 100)E:\Anaconda2\envs\LIDC\lib\site-packages\pylidc\Annotation.py in uniform_cubic_r
esample(self, side_length, resample_vol, irp_pts, return_irp_pts, verbose)
768
769 # Load the images. Get the z positions.
--> 770 images = self.scan.load_all_dicom_images(verbose=verbose)
771 img_zs = [float(img.ImagePositionPatient[-1]) for img in images]
772 img_zs = np.unique(img_zs)
E:\Anaconda2\envs\LIDC\lib\site-packages\pylidc\Scan.py in load_all_dicom_images
(self, verbose)
315 images = []
316 for dicom_file_name in sorted_fnames:
--> 317 with open(os.path.join(path, dicom_file_name), 'rb') as f:
318 images.append( dicom.read_file(f) )
319 return imagesFileNotFoundError: [Errno 2] No such file or directory: 'E:/Library/Datasets/DOI
\LIDC-IDRI-0048\1.3.6.1.4.1.14519.5.2.1.6279.6001.2081777976054741511065201243
06\1.3.6.1.4.1.14519.5.2.1.6279.6001.250863365157630276148828903732\000298.dcm
'
Full list of missing files that I encountered:
Hi, I'm so sorry to bother you. I have tried to visualize the mask and slices through the ann.visualize_in_3d(), but the output is just a three-dimensional image shown in my text editor. Therefore, I am wondering if there are actual 3d data in the LIDC datasets that I can interact with in different formats. Furthermore, is there a way that I can extract and save the 3d visualization on my computer just like what I can do for the slice and mask images?
I was adding a set of DICOM files to test on, as well as an XML file for Pylidc to read from. As such, I put the files in my LIDC-IDRI directory, and the path of the files are 'D:\LIDC-IDRI\LIDC-IDRI-1012\2.25.83166935061457396929107941819169230974\2.25.270306605818510402659631454860337221712'
Therefore, StudyInstanceUID = 2.25.83166935061457396929107941819169230974
and SeriesInstanceUID = 2.25.270306605818510402659631454860337221712
However, when my test program runs the following:
scan = pl.query(pl.Scan).filter(pl.Scan.patient_id == 'LIDC-IDRI-1012').first() print(scan.get_path_to_dicom_files())
it returns an error that it can't find the DICOM files.
File "C:\Users\Reader\Documents\scripts\dev\pylidc\pylidc\Scan.py", line 256, in get_path_to_dicom_files raise IOError("Couldn't find DICOM files for %s."%self) OSError: Couldn't find DICOM files for Scan(id=643,patient_id=LIDC-IDRI-1012)
Moreover, printing scan.annotations reveals that the annotations are also wrong/misread.
Not sure how Pylidc gets the wrong UIDs.
ImportError: Cannot import name "marching_cubes_lewiner' from skimage.measure'
Hey,
when running
scan = pl.query(pl.Scan).filter(pl.Scan.patient_id == 'LIDC-IDRI-0005').first()
scan.to_volume()
I'm getting
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/pylidc/Scan.py", line 453, in to_volume
images.append( dicom.read_file(f) )
File "/usr/local/lib/python3.5/dist-packages/dicom/filereader.py", line 614, in read_file
force=force)
File "/usr/local/lib/python3.5/dist-packages/dicom/filereader.py", line 515, in read_partial
preamble = read_preamble(fileobj, force)
File "/usr/local/lib/python3.5/dist-packages/dicom/filereader.py", line 477, in read_preamble
preamble = fp.read(0x80)
File "/usr/lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc4 in position 140: invalid continuation byte
for all patient DICOM files I tried so far.
Do you see what might be the problem?
Hi,
Is there a way to access dicom attributes through pylidc?
Thanks
Hi!
Thanks for this library -- it has been very useful!!
I was wondering if it is possible to change the path where the sqlite database is stored.
In the current code, the sqlite database is stored in the pylidc installation directory. This means the user must have permissions to write to this directory whenever they import pylidc. However this might not always be the case. For example consider a Dockerfile that looks like this:
USER root
pip install pylidc
USER userA
RUN python -c "import pylidc"
This will fail since userA does not have permissions to write to wherever the root user installed pylidc.
My current workaround is to install pylidc separately for every user. Instead, I was thinking we can change where the sqlite database is stored to a temporary directory like /tmp/pylidc.sqlite
?
Thanks again for your help!
Regards,
Nand
i am a beginner in LIDC dataset.could u please tell me how to specify path in config file.pylidcrc.I tried using the tutorial,but i got the following error.
vol = scan.to_volume()
2 print(vol.shape)
3
4 print("%.2f, %.2f" % (vol.mean(), vol.std()))
~/anaconda3/lib/python3.6/site-packages/pylidc/Scan.py in to_volume(self, verbose)
637 Return the scan as a 3D numpy array volume.
638 """
--> 639 images = self.load_all_dicom_images(verbose=verbose)
640
641 volume = np.zeros((512,512,len(images)))
~/anaconda3/lib/python3.6/site-packages/pylidc/Scan.py in load_all_dicom_images(self, verbose)
286 if verbose: print("Loading dicom files ... This may take a moment.")
287
--> 288 path = self.get_path_to_dicom_files()
289 fnames = [fname for fname in os.listdir(path)
290 if fname.endswith('.dcm')]
~/anaconda3/lib/python3.6/site-packages/pylidc/Scan.py in get_path_to_dicom_files(self)
213 "specified the path
option in the configuration "
214 "file {}?")
--> 215 raise RuntimeError(msg.format(_get_config_file()))
216
217 base = os.path.join(dicompath, self.patient_id)
RuntimeError: Could not establish path to dicom files. Have you specified the path
option in the configuration file /home/user/.pylidcrc?
Whenever I try to visualise any of the scans, I get an error as follows :
I have made the .pylidcrc file in the required location (/Users/shravaniurala/.pylidcrc) and have also mentioned the path to my dataset in it. The dataset is in an external hard drive
Please help me solve the same since I have tried to solve it multiple times by ensuring the file is in the correct location.
Hi, I print out this bounding box for first annotation as mentioned in tutorial. But I couldn't figure out the physical meaning of values in each of these tuple : slice(151, 185, None). Could you please help me understand it's meaning.
Thank you
import pylidc as pl
ann = pl.query(pl.Annotation).first()
print(ann.bbox())
RuntimeError: Could not establish path to dicom files. Have you specified the path
option in the configuration file /Users/gedelasnigda/.pylidcrc?
I am getting this runtime error
I have put this code in my configuration file:
[dicom]
path=/Users/snigda/Desktop/x/LIDC-IDRI
warn = True
In scitkit image versions 14 and above, the function marching_cubes
does not exist. Either marching_cubes_classic
or marching_cubes_lewiner
must be called explicitly.
Can someone help me please, I am new in image processing and I need to convert theese dicom images into nifty, also I need to obtain for each image the nodule segmentation, also in a nifty format? Thks
how can we obtain the physical bbox? (coordinate position) @notmatthancock
Is there a tutorial that can be a reference for me?
thanks
Hi, there a GUI for visualizing the scans and some meta information by using scan.visualize(annotation_groups=nods)
However, is it possible to extract the information about the slice number of annotation e.g. nodule 1, near slice 25
how can I extract this information using the pulidc functions?
Thank you
Hi!
Your library is amazing!
How can i cut the annotations from the base and save it as a new image (just the annotations) using pylidc? Is it possible?
OSError: Couldn't find DICOM files for Scan(id=12,patient_id=LIDC-IDRI-0001).
pylidc.conf is:
[dicom]
path =C:\Users\Pollob\ct img\LIDC-IDRI
warn = True
actually where is the problem? anyone please help me.i am not able to fix****
Hi, I really want to know if it is possible to give the path of a scan as "./LIDC-IDRI/LIDC-IDRI-0001" and return the .dcm that has more than 3 annotations and the .dcm that has 0 annotation, this is to separate the dicoms of a certain patient into "image with nodule" and "image without nodules". I would appreciate if you could get help with this and thanks in advance.
Received the error below while running the example code
AttributeError Traceback (most recent call last)
in ()
17
18 ann = q.first()
---> 19 print("%.2f, %.2f, %.2f" % (ann.diameter, ann.surface_area, ann.volume))
20 # => 17.98, 1221.40, 1033.70
AttributeError: 'Annotation' object has no attribute 'diameter'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.