The data is from IDC and loads into slicer with the IDC viewer.
SeriesInstanceUID to download: 1.3.6.1.4.1.14519.5.2.1.2932.1975.255072988367557196694880426160
There is the strange value of Spacing Between Slices (0x0018, 0x0088) -1. BTW, there seems to be a bug (or “behavior change”) in recent GDCM IO that may be related, s. ITK issue 4794. But I am not sure, just FYI. cc @dzenanz
dciodvfy: Error - Illegal negative value - SpacingBetweenSlices = -1
I can confirm that Spacing Between Slices-1 causes the problem. I have changed it to 1 (don’t know what the value should be, but AFAIK it should be taken from IPP/IOP) and the series loads (latest preview, Linux)
Also for convenience, the BigQuery query below will select all series in Imaging Data Commons that have negative SpacingBetweenSlices.
WITH
temp_table AS (
SELECT
SeriesInstanceUID,
Manufacturer,
collection_id,
Modality,
SpacingBetweenSlices
FROM
`bigquery-public-data.idc_current.dicom_all`
WHERE
SAFE_CAST(SpacingBetweenSlices AS INT64)<0)
SELECT
SeriesInstanceUID, any_value(Manufacturer) as Manufacturer, any_value(collection_id) as collection_id, any_value(Modality) as Modality, any_value(SpacingBetweenSlices) as SpacingBetweenSlices
FROM
temp_table
group by SeriesInstanceUID
order by Modality
For the sake of convenience, the result of running the query is below. You can plug in SeriesInstanceUID into the instructions above to download any of those series.
If you would like to see any of the series in the IDC-hosted OHIF v3 instance, you can get series-specific URL using the code below (after installing idc-index as discussed earlier):
from idc_index import IDCClient
series_uid ="1.3.6.1.4.1.14519.5.2.1.2932.1975.255072988367557196694880426160"
c = IDCClient()
c.get_viewer_URL(seriesInstanceUID=series_uid, viewer_selector="ohif_v3")
After looking at this in more detail, I’m not convinced that the new GDCM behavior about using the SpacingBetweenSlices is actually incorrect. I’ll comment on why in the ITK issue.
For Slicer, the issue has something to do with how non-right-handed direction matrices are handled. If I add this line
seriesReader->SetForceOrthogonalDirection(false);
in vtkITKArchetypeImageSeriesReader::RequestInformation then the volume loads correctly. Without it the image loads upside down and the acquisition transform is not able to fix it.
But since that option about orthogonal directions has been around for six years it seems that something else recently has broken the path when this flag is not set, and perhaps that is due to the negative spacing.
I’m not sure when I’ll have a chance to dig into this more so I thought I’d post this note in case @lassoan, @jcfr, @issakomi, or others know more.
If you suspect that the normalization to right-handed coordinate system causes issues then make sure you use the latest Slicer main version (there were a few versions that did not work correctly) and/or call vtkMRMLVolumeArchetypeStorageNode.SetForceRightHandedIJKCoordinateSystem(False) to disable this mechanism completely.
Yes, I’m testing with the current main branch and I tried removing commenting out the part of the ScalarVolumePlugin that forces the right-handed behavior and it didn’t change anything. I think the issue is in ITK, because when I set seriesReader->SetForceOrthogonalDirection(false); I get an identity direction matrix which is correct for this LPS axial IS scan, but without it (the default true value) I get a minus one in the lower left.
I have also meet this problem.
There is no problem using version 5.6.2. I built version 5.7.0 from the source code. This problem occurs after some DICOM files are imported.
When I change the -1 of the direction matrix, the DICOM display will be normal, but after using the AI generated model of lungCTsegmenter, the generated segmentation position is misplaced.
I want to know which part of the source code should be modified to correct the problem when importing DICOM.
I don’t dare to roll back the code version directly to 5.6.2, because I want to use the py translation fixed in 5.7.0.
If I roll back the itk version in superbuild to 5.3.0, there are still many related errors.
Thanks for reporting @MikhayEeer . @lassoan let’s discuss in the dev meeting but I suggest we go ahead and make this change in the preview version of Slicer and see if we hear of other regressions.
After some more testing and discussion during today’s dev meeting I’m convinced adding this flag is a good way forward. If anybody notices regressions in the preview builds please speak up since this fix will in the 5.8 release coming the the next few weeks.