Get all series from current study in viewer

118 views
Skip to first unread message

Carlos Hernández

unread,
Nov 22, 2016, 1:04:08 AM11/22/16
to dcm4che
Greetings to all.

How I can do to get all the series of the study that is open in the viewer, I am trying to access from the sample toolbar plugin. Any link or piece of code?

Thanks in advance.

Nicolas Roduit

unread,
Nov 25, 2016, 2:29:11 AM11/25/16
to dcm4che


With something like that:
        ViewCanvas<DicomImageElement> view2DPane = EventManager.getInstance().getSelectedViewPane();
        if (view2DPane != null) {
            MediaSeries<DicomImageElement> series = view2DPane.getSeries();
            if (series != null) {
                DataExplorerModel model = (DataExplorerModel) series.getTagValue(TagW.ExplorerModel);
                TreeModel treeModel = null;
                if (model instanceof TreeModel) {
                    treeModel = (TreeModel) model;
                    MediaSeriesGroup study = treeModel.getParent(series, DicomModel.study);
                    if (study != null) {
                        for (MediaSeriesGroup s : treeModel.getChildren(study)) {
                            if(s instanceof MediaSeries){
                                
                            }
                        }
                    }
                }
            }
        }

Kathirvel Kulanthaivelu Gomathy

unread,
Nov 25, 2016, 12:14:32 PM11/25/16
to dcm4che
Hi Nicolas,
    Am working on a similar usecase where I want to add a reporting feature to the Weasis Viewer. I want just the path of the currently opened study; from there I will load the patient, study data into the reporting application and from there Radiologist can type the report.
I tried to create a new project based on archetype 'weasis-plugin-dicom-viewer' and added the following extra dependencies

<dependency>
            <groupId>org.weasis.base</groupId>
            <artifactId>weasis-base-viewer2d</artifactId>
            <version>${project.parent.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.weasis.dicom</groupId>
            <artifactId>weasis-dicom-codec</artifactId>
            <version>${project.parent.version}</version>
            <scope>provided</scope>
        </dependency>       
        <dependency>
            <groupId>org.weasis.dicom</groupId>
            <artifactId>weasis-dicom-explorer</artifactId>
            <version>${project.parent.version}</version>
            <scope>provided</scope>
        </dependency>

and used the above code, I couldn't proceed further. Sorry for my limited maven knowledge, am strong in DICOM concepts but knows just core java.

If its possible to get the patient, study data directly it would be great.

Thanks in advance.

Kathirvel Kulanthaivelu Gomathy

unread,
Nov 26, 2016, 1:59:51 AM11/26/16
to dcm4che
If you could share some code to get the patient, study and data directly, it would be highly helpful. Thanks

Nicolas Roduit

unread,
Nov 26, 2016, 3:19:53 AM11/26/16
to dcm...@googlegroups.com
If you mean all the data loaded in the application, you need to iterate through de DicomModel:
        DataExplorerView dicomView = org.weasis.core.ui.docking.UIManager.getExplorerplugin(DicomExplorer.NAME);
        DicomModel model = (DicomModel) dicomView.getDataExplorerModel();
        synchronized (model) {
            for (MediaSeriesGroup patient : model.getChildren(MediaSeriesGroupNode.rootNode)) {
                TagW ptName = TagD.get(Tag.PatientName);
                System.out.println(ptName.getFormattedTagValue(patient.getTagValue(ptName), "Patient Name: $V"));
                for (MediaSeriesGroup st :  model.getChildren(patient)) {
                    TagW studyDesc = TagD.get(Tag.StudyDescription);
                    System.out.println(studyDesc.getFormattedTagValue(st.getTagValue(studyDesc), "Study Description: $V"));
                    for (MediaSeriesGroup series: model.getChildren(st)) {
                        TagW seriesDesc = TagD.get(Tag.SeriesDescription);
                        System.out.println(seriesDesc.getFormattedTagValue(series.getTagValue(seriesDesc), "Series Description: $V"));
                        if (series instanceof MediaSeries) {
                            
                        }
                    }
                }
            }
        }

Kathirvel Kulanthaivelu Gomathy

unread,
Nov 26, 2016, 8:43:42 AM11/26/16
to dcm4che
Hi Nicholas
    Thankyou very much for your kind help. I am able to get it work.
If you could help me out in getting the path where the currently loaded study is stored (local file system path), it will be highly helpful.

Thanks again,
Kathirvel

Carlos Hernández

unread,
Nov 27, 2016, 12:35:26 AM11/27/16
to dcm4che
Thank you very much, with these examples I was able to solve what I needed.

Works like a charm.

Kathirvel Kulanthaivelu Gomathy

unread,
Nov 30, 2016, 10:24:57 AM11/30/16
to dcm4che
Hi Nicholas,
    Can you please share some snippet on how to get the local cached path of the study in currently viewed. I need this for a separate process.
And I am able to create the plugin and test it in portable and web distribution and it worked like a charm. Thanks for it.

Nicolas Roduit

unread,
Dec 4, 2016, 4:55:19 PM12/4/16
to dcm4che
There is no place that you can directly copy images because the images could be in memory, in a local path or in a cache. You must save an image from the following way:
A MediaSeries contains a list of MediaElement which have a method: saveToFile(File output).
Reply all
Reply to author
Forward
0 new messages