Weasis icon indicating copy to clipboard operation
Weasis copied to clipboard

Export broken with some studies

Open leonardorame opened this issue 3 years ago • 12 comments

Hi, I found the File->Export->Dicom->Local Device option cannot handle some studies.

This case was tested with 2.6.2, 3.0.1 and 3.7.0 with two CT Coronary studies.

Both studies have many series, and some of those series more than 1000 images. I can view all the images without issues, but the Export Dicom option does now show the series tree correctly.

Here's what is shown on that option, the date on one node, a series called "2.0" wich is a Localizer, then another node with the Patient name, a subnode with the date and a 3rd node with one series with one image, but all other (more than 10) series are not shown.

image

@nroduit, I can provide a link (by email) to the URL to that study if you need.

leonardorame avatar Mar 15 '21 21:03 leonardorame

If I uncheck "Download all series immediately" from the Preferences->Series downloader menu and re-open the study I can see the correct series structure, but of course with 0 instances.

image

If I click on the green triangle to start downloading then the Export screen is broken again.

leonardorame avatar Mar 15 '21 22:03 leonardorame

Do you have errors in the log file? If you can send me an example of data that can reproduce the problem.

nroduit avatar Mar 16 '21 06:03 nroduit

I've sent you an email with an URL for accessing the sample data.

leonardorame avatar Mar 16 '21 07:03 leonardorame

The problem appears because the name in xml and the name in DICOM file are different. You should fix the error in the xml you provide. The unique behavior of a patient is defined here.

There is an mechanism to fix inconsistent ID within a study but in this case sometimes it doesn't work. I will check that later.

nroduit avatar Mar 16 '21 21:03 nroduit

Hi Nicolas, I modified PatientName and PatientId on the XML to match exactly the 0010,0010 and 0010,0020 tags of the images, but sadly the problem is still present.

If you re-open the example I've sent by email the xml data you'll get contains the modified PatientName and PatientId.

leonardorame avatar Mar 17 '21 02:03 leonardorame

I guess it is something related with the xml manifest because when loading the images locally the export tree is correct.

I don't have time to check that now, but I will handle this bug later.

nroduit avatar Mar 17 '21 07:03 nroduit

Yes, it might be related to the xml manifest generated automatically for this specific study, because all other CTs and MRs doesn't present this behavior.

leonardorame avatar Mar 17 '21 10:03 leonardorame

Hi again Nicolas, I configured Weasis to do a Query/Retrieve of that study, so no XML is used, but the problem is also present in that configuration.

leonardorame avatar Mar 17 '21 13:03 leonardorame

I've sent you an email with an access to a simplified XML that let you open the study with only on series (the localizer) that looks like the root of the problem.

leonardorame avatar Mar 17 '21 16:03 leonardorame

The StudyInstanceUID in the manifest does not match the one in the file. It is difficult to fix this problem because it exists in 2 detached asynchronous processes and UIDs are used as a unique key in the in-memory database.

I provided an improvement for those inconsistent UIDs, see https://github.com/nroduit/Weasis/issues/186

nroduit avatar Mar 20 '21 14:03 nroduit

Thanks, now it works as expected.

The only issue now is the text in the green rectangle that I assume was left for debugging purpouses.

image

BTW, I can easily fix the wrong StudyInstanceUID from the manifest, then try again with 3.7.0.

leonardorame avatar Mar 20 '21 19:03 leonardorame

No this is the consequence of the UID mismatch. I didn't find a solution without either breaking download or removing part of thumbnails. Study/series/instance UID are the most important elements of the DCOM file structure. So they cannot be incorrect.

The fix is to make Weasis a little more resilient to these problems.

nroduit avatar Mar 21 '21 19:03 nroduit

Please reopen this issue if it has not been resolved in the current version.

See also https://github.com/nroduit/Weasis/issues/186 and https://github.com/nroduit/Weasis/issues/254

nroduit avatar May 27 '23 07:05 nroduit