View Issue Details

IDProjectCategoryView StatusLast Update
0003806Slicer4Module DICOMpublic2018-06-01 23:58
ReporterfedorovAssigned Tonicole 
PrioritylowSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionSlicer 4.9.0Fixed in VersionSlicer 4.9.0 
Summary0003806: Imported DICOM file does not show up in widget under certain conditions
Description

Steps to reproduce:

1) create empty Slicer DICOM DB using DICOM widget GUI
2) create indexer in python console, import one DICOM instance (tested with one instance from MR image
series)
3) delete instance from DICOM db using widget GUI
4) import the same instance again using indexer --> it does not show
up in the GUI
5) import the same instance again using indexer --> message on the
console "File already added", does not show up in GUI
6) restart Slicer --> DICOM widget GUI is empty
7) import the same instance again using indexer --> message on the
console "File already added", GUI still does not list anything

Additional Information

@pieper says this is a CTK issue, but until reproduced in CTK, it's a Slicer bug

TagsNo tags attached.

Activities

pieper

pieper

2014-08-15 05:25

administrator   ~0012375

Thanks for filing this Andrey and thanks Nicole for investigating. If debugging isn't leading anywhere, it would be great if you could create a small self test to replicate the issue. I think the ultimate solution is going to require single stepping through some of the ctkDICOMDatabase code, and that will be facilitated if we can easily get back to a known state.

nicole

nicole

2014-10-14 07:39

administrator   ~0012616

Related bug fix for loading derived data:
http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=23737

nicole

nicole

2014-10-14 07:41

administrator   ~0012617

Last edited: 2018-05-30 14:30

View 2 revisions

Reproducible in Slicer as of Oct 10/14:
Select a new empty directory in the DICOM GUI
python console:

indexer = ctk.ctkDICOMIndexer()
derivedItem = slicer.app.slicerHome + '/../../Slicer/Testing/Data/Input/CTHeadAxialDicom/CTHead1.dcm'
indexer.addFile(slicer.dicomDatabase, derivedItem)
# can see it.
# click on it and remove it via gui
indexer.addFile(slicer.dicomDatabase, derivedItem)
# not seeing it in gui
jcfr

jcfr

2015-11-12 15:18

administrator   ~0013608

Is this still an issue ?

fedorov

fedorov

2015-11-12 17:51

developer   ~0013611

Yes, I've just tried, and steps in the comment above by Nicole still result in the item not showing up in the DICOM browser GUI.

pieper

pieper

2015-11-14 03:58

administrator   ~0013616

There is some logic in the ctkDICOMDatabase indexer that tries to optimize database insertions (it has caused issues before by over-optimizing in certain cases). it would be good to try a non-gui test program that operates directly at the ctk lib level and checks to see if the object is correctly inserted the second time. Nicole, let me know if you want to look at this together.

lassoan

lassoan

2017-06-10 00:18

developer   ~0014715

I've experienced this issue several times: once a patient is deleted, it does not show up in the DICOM browser, but it cannot be added again to the database. Probably data is only deleted at the patient and/or study level.

Workaround: delete the DICOM database directory or select a new database directory.

lassoan

lassoan

2017-06-10 00:18

developer   ~0014716

Workaround exists and the issue has been around for years, therefore it is not blocking.

fedorov

fedorov

2017-06-14 13:03

developer   ~0014836

I still believe that for many users who encounter this it will be a blocker. I think the assumption that every user who comes across a problem will ask for help on the email list is overly optimistic. I know people who are not newcomers in the field, but they will almost never contact forum. In any case, I don't think the assignment of the issue status has any effect on anything, so it is just a rant item really.

lassoan

lassoan

2018-05-31 09:27

developer   ~0015860

IDs of last inserted patient, study, series items were cached in the ctkDICOMDatabase to avoid re-inserting when adding each file instance. However, if this patient, study, or series are removed from the database, then their IDs have to be cleared to force adding them back to the database when adding a file instance. Clearing of IDs when items are deleted has been implemented in ctkDICOMDatabase. The problems is that an application may use multiple database connections (ctkDICOMDatabase instances) to connect to the same database, and delete items corresponding to the cached IDs.

Fixed the problem by deleting cached item IDs once, just before a batch of instances are inserted to the database.

To define what is the beginning and end of a "batch", startIndexing and endIndexing method was added to ctkDICOMIndexer. They are called automatically when any of the ctkDICOMIndexer::add...() methods is used. Start/end indexing methods are exposed on the public API as well so that applications can do multiple ctkDICOMIndexer::add...() calls in one batch.

Pull request of the fix was submitted: https://github.com/commontk/CTK/pull/807

lassoan

lassoan

2018-05-31 09:55

developer   ~0015861

How to test:

from DICOMLib import DICOMUtils

indexer = ctk.ctkDICOMIndexer()
derivedItem = slicer.app.slicerHome + '/../../Slicer/Testing/Data/Input/CTHeadAxialDicom/CTHead1.dcm'
indexer.addFile(slicer.dicomDatabase, derivedItem)
DICOMUtils.refreshDICOMWidget()
# can see it.

# click on it and remove it via gui

indexer.addFile(slicer.dicomDatabase, derivedItem)
DICOMUtils.refreshDICOMWidget()
# can see it (problem fixed)
jcfr

jcfr

2018-06-01 23:58

administrator   ~0015870

Thanks to @lassoan, this was fixed in http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=27228

For future reference, the corresponding PR was https://github.com/commontk/CTK/pull/807

Issue History

Date Modified Username Field Change
2014-08-14 18:13 fedorov New Issue
2014-08-14 18:13 fedorov Status new => assigned
2014-08-14 18:13 fedorov Assigned To => pieper
2014-08-14 18:13 fedorov Severity minor => block
2014-08-14 18:13 fedorov Assigned To pieper => nicole
2014-08-15 05:25 pieper Note Added: 0012375
2014-10-14 07:39 nicole Note Added: 0012616
2014-10-14 07:41 nicole Note Added: 0012617
2015-11-12 15:18 jcfr Note Added: 0013608
2015-11-12 15:18 jcfr Status assigned => feedback
2015-11-12 17:51 fedorov Note Added: 0013611
2015-11-14 03:58 pieper Note Added: 0013616
2017-06-10 00:18 lassoan Note Added: 0014715
2017-06-10 00:18 lassoan Severity block => major
2017-06-10 00:18 lassoan Note Added: 0014716
2017-06-10 14:36 jcfr Priority normal => low
2017-06-14 12:57 lassoan Summary Imported file does not show up in widget under certain conditions => Imported DICOM file does not show up in widget under certain conditions
2017-06-14 13:03 fedorov Note Added: 0014836
2017-06-14 13:03 fedorov Status feedback => assigned
2018-05-30 14:30 lassoan Note Edited: 0012617 View Revisions
2018-05-31 09:27 lassoan Note Added: 0015860
2018-05-31 09:55 lassoan Note Added: 0015861
2018-05-31 09:56 lassoan Target Version => Slicer 4.9.0
2018-06-01 23:58 jcfr Status assigned => resolved
2018-06-01 23:58 jcfr Resolution open => fixed
2018-06-01 23:58 jcfr Fixed in Version => Slicer 4.9.0
2018-06-01 23:58 jcfr Note Added: 0015870