Show patient comments field in DICOM browser

HI there,

I have a lot of DICOMs imported form OSIRIX, and a lot of those studies have been commented in OSIRIX (I don’t mean a report was created, I mean on a list in OSIRIX there is a column named comment, and you can put there a word, or two).

Question - is there a way to visualise such comment in Slicer, make a column in list view of DICOMs, etc? This info is stored in DICOM files.

Regards,
Lukasz

It is highly unlikely that Osirix modifies the original DICOM images. You can check if the comment is included in exported images by importing them into Slicer and checking metadata content (by right-clicking on the the image in Slicer DICOM browser and choosing “View metadata”).

If comments are not exported to DICOM files then you can read it from the DICOM database of Osirix. Many years ago they used sqlite database for this (maybe the still do), which can be easily read in Python.

That is true, such field is not present in DICOM when I use “view metadata”. How can access is in SQLite? Can you suggest me this Python script?

Regards,
Lukasz

To explore what tables are in the database and implent the query you need, you can use viewers, such as https://sqlitebrowser.org/

Then, you can write the Python script that gets and the information you need. There are many Python Sqlite tutorials, for example https://www.tutorialspoint.com/sqlite/sqlite_python.htm. We can help if you are not sure how to use the retrieved information in Slicer.

OK, thank you. I get that.

Another thing - I very much miss PatienComments column in 4.11.
This is how it looks in your manual regarding v. 4.10.
DICOM_Screenshot-1_1204-11-17-10-36
But it is not visible in 4.11. Can I retrieve the column somehow?

Regards,
Lukasz

In Slicer-4.11, you can configure the name, visibility, formatting, and order of DICOM browser columns as shown in the script repository.

We made patient comments hidden by default because it is almost never used in clinical practice, but you can make it visible by typing this into the Python console (you only need to do this once, as column display properties are stored persistently in the database):

dicomBrowser = slicer.modules.dicom.widgetRepresentation().self().browserWidget.dicomBrowser
dicomDatabase = dicomBrowser.database()
dicomDatabase.setVisibilityForField('Patients', 'PatientsComments', True)
dicomDatabase.setWeightForField('Patients', 'PatientsComments', 8)
dicomDatabase.closeDatabase()
dicomDatabase.openDatabase(dicomBrowser.database().databaseFilename)

OK, Thanks.

Now I see comments column, but how can I actually comment the examination in there? Or can I only read what is contained in “PatientComments” in DICOM?

Regards,
Lukasz

Content of the comment field is set from the DICOM file. If you want to modify the field then you need to modify the DICOM file and re-index the file.

@cpinter I know that you have worked on something similar in custom projects. Are field editing features planned to be added to Slicer core as well?

@l.znaniecki Can you tell a bit more about your use case? Why would you like to change these DICOM fields? To fix mistakes in fields, make it easier to find data sets or build patient cohorts, …?

Good question.

To build patient cohorts, and then, to easily find data sets.

Is there a way to customize Slicer in that direction? (I feel yes, there is, based on your question to @cpinter :wink: )

Regards,
Lukasz

We will probably make some field editing possible for fixing errors (e.g., typo in patient name) or adding missing information.

However, field editing would interfere with cohort building, as after any modification of a DICOM file (if the DICOM files might be accessed by an external system) you need to generate new UIDs, refer to the old instances, and preferably also notify connected information systems that the old version of the data set is now obsolete and share the updated version. Instead, typically cohorts are built by compiling information from the DICOM header and other non-imaging sources into spreadsheets or other specialized cohort building tools (you can add comments or any extra information there), then exporting minimal, anonymized data set for analysis (often this is not even in DICOM format anymore, but in nrrd or other research file formats).

OK, thank you for this answer.

So I would probably need:

  1. build a repository of anonymized DICOMs (PACS?)
  2. have a separate tool to connect those DICOMs with cohort building toll (what tool would you suggest?) - by patient ID for example?
  3. have a tool to export selected packets (based on some comments) of DICOMs from PACS to nrrd and import them to Slicer - scripts?

I would greatly appreciate your help to establish an efficient tool to work on hundreds of CT DICOMs.

Thanks,
Regards,
Łukasz

We implemented editing capabilities in a Slicer custom app that uses DCMTK’s dcmodify tool and sets the changed fields such as patient comments. However, we haven’t gotten as far as re-generating UIDs and referencing the old dataset etc. The DICOM database in that particular case is completely controlled by the workstation and there is no chance that someone has accessed the old dataset externally, so this feature has been delayed. This is the main reason we haven’t integrated it into Slicer. The other reason is that the UI the custom app uses for editing is not the DICOM table view.

1 Like