tomdoel / pulmonarytoolkit

Lung medical image analysis and visualisation software for Matlab.
GNU General Public License v3.0
84 stars 57 forks source link

Deleting multiple patients #40

Closed jakublaznovsky closed 4 years ago

jakublaznovsky commented 4 years ago

Hello, thanks for developing Pulmonary Toolkit. Maybe, I just did something wrong while importing the data, but every single slice from the measurement imported as an individual patient. So the result is about 200 imported patients in patient browser. Is there any possibility how to delete multiple patients in one operation? Or an option to reset all settings of PTK? Thank you in advance.

tomdoel commented 4 years ago

Hi,

One common reason this can happen is if the Patient ID tag has been removed, or is not the same for each slice - these most likely occur due to an anonymisation process not being correctly configured. PTK needs the Patient ID to be present and the same on each slice. If thats not the case the tags can be added or corrected using a Dicom edit tool eg Horos or DicomBrowser. You would then need to delete the datasets from PTK and re-import them.

To delete multiple patients: You can use the API to delete multiple patients by deleting each series for each patient. The DeleteDatasets() call on a PTKMain() object takes in a cell array which are the series uids to delete. For example the following script will delete every patient and every series:

ptk_main = PTKMain();

% Delete all series for all subjects
all_uids = ptk_main.FrameworkAppDef.GetFrameworkDirectories().GetUidsOfAllDatasetsInCache();
ptk_main.DeleteDatasets(all_uids); 

To completely reset PTK and delete all your imported data, edits and results:

Keyboard Shortcut for deleting a single series: The Delete key will delete the currently loaded series

jakublaznovsky commented 4 years ago

Hello Tom, Thank you for an exhaustive answer. You are right that I've imported badly anonymised Dicom data. Whole patients database was deleted via your code, Dicom data was properly configured, and everything works perfectly! Thanks

tomdoel commented 4 years ago

Thank you for your comments. I'm glad everything is working!