Voxel mask is in the wrong location

When I run OspreyCoreg the voxel mask is placed in the wrong location:

Here is where the voxel mask should be:
This is after I select add overlay and open the raw svs file, and the voxel is shown in red here:

I’m not sure why Osprey (or SPM?) places the mask in the wrong place- and it only happens to two particiapants. Any advice on why this could be happening?

Hi Julia,
is it measured with a Siemens Scanner? Which version?
Have you used fixed table position?
What I could most likely imagine is that there has been a change in the table position and this is stored in a different position than the one used in the Osprey script.

Best,
Heiner

Hi Heiner,

Thank you for your help.

Yes, it’s Siemens Magnetom Prisma 3T. The software versions for my data are both syngo MR XA30 and syngo MR E11. The errors for both scans are for files recorded with the new (latter) version of the software.

I don’t know what table position we use. When you say change in table position do you mean between the anat and mrs scans? Is that something I can check by looking at the sidecar metadata? I uploaded one sidecar file in case that might help; (I’m having issues with accessing the private tags in the new software version, which is why so many don’t have names).

sub-223_ses-MRI2_voi-ACC_acq-pres_svs.txt (27.7 KB)

Hi Julia,
have you had a fixed table position between your anatomical scans and the spectroscopy (in the isocenter) or has the table been moved between the measurements? In the coregistration script (osprey/coreg/coreg_siemens.m at develop · schorschinho/osprey · GitHub), in line 60f a change in the table position is taken into account. For Twix files, I see that Osprey reads in this value, but I can’t see it for rda. Also when I look in some files I see this field in twix, but not in rda. I don’t know if rda considers this in another way. Which format have you used? From your file, I would say that your table was repositioned by 43mm (see tag (0021,105f) ‘TP H43’ (TP Table positioning?), from dicm2nii/dicm_dict.m at master · xiangruili/dicm2nii · GitHub this text should be RelativeTablePositionText). I see the same number in the tag (0021,105d) , (0021, 1059) and (0021, 1005). When you add these 43mm in head direction, the voxel positioning could be better. :wink:

Best,
Heiner

Hi Heiner,

I don’t think the table moved betweet anatomical and MRS scans. My MRS data is a Siemens dicom scan, which wasn’t in the Osprey job file examples, so I just adapted them as best as I can. For anatomical images I use dicom files that were coverted to nifti. You can examples of the MRS data here, including sidecar file.

In the MRSCont.raw{1,27}.geometry.pos file I can only see the PosCor, PosSag, PosTra values (no TablePosTra field), so it would mean that in line 60 of the code it doesn’t use the table position values for calculating VoxOffs.

I couldn’t find any of the tags you mentioned. I’ve been having problems with accessing private and CSA headers for my data (see the linked repo), so I wonder if it’s possible that Osprey might not be able to access some of the tags? Although then I’d expect to see this problem for more than 2 participants.

Hi @juliam98,

Can you try converting your MRS data to NIfTI-MRS (with wtclarke/spec2nii: Multi-format in vivo MR spectroscopy conversion to NIFTI (github.com)) and see if the voxel mask it generates looks better? I can’t rule out that our DICOM co-registration routine is indeed missing a private header field - we haven’t seen that much Siemens DICOM data over the years tbh.

Thanks,
Georg

Hi Julia,
what was the ‘positioning mode’ (System → Misc.) for your measurement? For example, with ‘ISO’, the table positioning don’t have to be the same. In the dicom tag (0021,1059) I have a table position of 45mm for proband 217 and 22mm for proband 223 (you get these information for example in Matlab with dicominfo → .PerFrameFunctionalGroupsSequence.Item_1_Private_0021_10fe…). Maybe @admin 's suggestion will be a good step. Also a .json header from proband 217/223 would be interesting to see the differences between dicom and nifti format.

Best,
Heiner

Hi Georg,

I just re-run the analysis with nifti data. I used the exact same job file, only changed the paths, so that nifti rather than dicom files are selected. I got to the segmentation stage and I got this error message:

Timestamp October 07, 2024 18:02:55 Osprey 2.8.1  OspreyCoreg
Coregistering voxel from dataset  27 out of  27 total datasets...

... done.
 Elapsed time 125.571671 seconds
Timestamp October 07, 2024 18:05:07 Osprey 2.8.1  OspreySeg
Vendor not supported. Please contact the Osprey team (gabamrs@gmail.com).Error using OspreySeg
Vendor not supported. Please contact the Osprey team (gabamrs@gmail.com).

I never got this error before. Is it because Siemens nifti data is not supported?

The good news is that the voxel masks are in the same location as the original mrs file- so the coordinates are not shifted anymore.

Hi Julia,
can you check the field ‘manufacturer’ in the .json file. If it is not ‘siemens’, in osp_LOADNII MRSCont.vendor will be set to ‘NIFTI’ and this results in your error.

Hi Heiner,

I checked the .mat file (I assume .json is only when you use the GUI?) and the vendor field is empty and datatype is ‘NIfTI-MRS’.

I tried setting it manually by typing MRSCont.vendor='Siemens' and then running OspreySeg again, which did work- I didn’t get the above error, but then it’s as if Osprey doesn’t see the segmentation files it created and after OspreyQuantify I don’t get any partial-volume corrected results

Hi Heiner,

I extracted the information from dicom files with dicominfo.

Here is the output
                              Filename: '/data/project/SV2A_MC1/LEV/sourcedata/sub-223/ses-MRI1/23-ACC_svs_se_30_noECC/resources/secondary/2.25.33716079862265211863916389977003206796-23-1-b2mimh.dcm'
                           FileModDate: '05-Aug-2024 09:42:00'
                              FileSize: 146432
                                Format: 'DICOM'
                         FormatVersion: 3
                                 Width: 1
                                Height: 1
                              BitDepth: []
                             ColorType: ''
        FileMetaInformationGroupLength: 174
            FileMetaInformationVersion: [2×1 uint8]
               MediaStorageSOPClassUID: '1.2.840.10008.5.1.4.1.1.4.2'
            MediaStorageSOPInstanceUID: '2.25.177999680964357025926759141767136577599'
                     TransferSyntaxUID: '1.2.840.10008.1.2.1'
                ImplementationClassUID: '1.2.40.0.13.1.1'
             ImplementationVersionName: 'dcm4che-2.0'
                  SpecificCharacterSet: 'ISO_IR 100'
                             ImageType: 'ORIGINAL\PRIMARY\SPECTROSCOPY\NONE'
                           SOPClassUID: '1.2.840.10008.5.1.4.1.1.4.2'
                        SOPInstanceUID: '2.25.177999680964357025926759141767136577599'
                             StudyDate: '20240626'
                            SeriesDate: '20240626'
                           ContentDate: '20240626'
                   AcquisitionDateTime: '20240626151636.550000'
                             StudyTime: '144900.300000'
                            SeriesTime: '152125.259000'
                           ContentTime: '152125.264000'
                       AccessionNumber: '2.25.90573997904591162582072158264976865067'
                              Modality: 'MR'
                          Manufacturer: 'Siemens Healthineers'
                      StudyDescription: '223 LEV Synaptic_Connectivity'
                     SeriesDescription: 'ACC_svs_se_30_noECC'
               PerformingPhysicianName: [1×1 struct]
                 ManufacturerModelName: 'MAGNETOM Prisma'
       ReferencedImageEvidenceSequence: [1×1 struct]
                  VolumetricProperties: 'DISTORTED'
       VolumeBasedCalculationTechnique: 'NONE'
                 ComplexImageComponent: 'COMPLEX'
                   AcquisitionContrast: ''
             Private_0009_10xx_Creator: 'SIEMENS SYNGO INDEX SERVICE'
                     Private_0009_108c: ''
                           PatientName: [1×1 struct]
                             PatientID: '223_LEV'
                            PatientSex: 'M'
                            PatientAge: '056Y'
                           PatientSize: 1.7600
                         PatientWeight: 81
                DeidentificationMethod: 'RSU XNAT Migration Anonymisation'
    DeidentificationMethodCodeSequence: [1×1 struct]
                      BodyPartExamined: 'HEAD'
                 MagneticFieldStrength: 3
                    DeviceSerialNumber: '166001'
                      SoftwareVersions: 'syngo MR XA30'
                          ProtocolName: 'ACC_svs_se_30'
                     SpatialResolution: 1
                 DateOfLastCalibration: '20090304'
                 TimeOfLastCalibration: '123723'
                                 B1rms: 0.4833
                       PatientPosition: 'HFS'
                  ContentQualification: 'PRODUCT'
                     PulseSequenceName: '*svs_se'
                     EchoPulseSequence: 'SPIN'
                      MultipleSpinEcho: 'NO'
                 MultiPlanarExcitation: 'NO'
              SteadyStatePulseSequence: 'NONE'
               EchoPlanarPulseSequence: 'NO'
         SpectrallySelectedSuppression: 'NONE'
             GeometryOfKSpaceTraversal: 'RECTILINEAR'
              SegmentedKSpaceTraversal: 'SINGLE'
      RectilinearPhaseEncodeReordering: 'LINEAR'
                         SpectralWidth: 2500
                ChemicalShiftReference: 4.7000
           VolumeLocalizationTechnique: 'PRESS'
                            Decoupling: 'NO'
                       KSpaceFiltering: 'NONE'
                   TimeDomainFiltering: 'NONE'
                     NumberOfZeroFills: 0
                    BaselineCorrection: 'NONE'
                   AcquisitionDuration: 288
            NumberOfKSpaceTrajectories: 96
                  TransmitterFrequency: 123.2564
                       ResonantNucleus: '1H'
                   FrequencyCorrection: 'NO'
            VolumeLocalizationSequence: [1×1 struct]
        ApplicableSafetyStandardAgency: 'IEC'
             FirstOrderPhaseCorrection: 'NO'
        WaterReferencedPhaseCorrection: 'NO'
         MRSpectroscopyAcquisitionType: 'SINGLE_VOXEL'
                      StudyInstanceUID: '2.25.33716079862265211863916389977003206796'
                     SeriesInstanceUID: '2.25.213163794981317675354039994899504403111'
                          SeriesNumber: 23
                     AcquisitionNumber: 1
                        InstanceNumber: 1
                   FrameOfReferenceUID: '2.25.220336403547836318242034007493649949118'
                            Laterality: 'U'
            PositionReferenceIndicator: ''
         DimensionOrganizationSequence: [1×1 struct]
                DimensionIndexSequence: [1×1 struct]
             Private_0021_10xx_Creator: 'SIEMENS MR MRS 05'
             Private_0021_11xx_Creator: 'SIEMENS MR SDR 01'
                     Private_0021_1001: 257.8378
                     Private_0021_1101: 'ACQUISITION'
                     Private_0021_1102: 'ACQUISITION'
                        NumberOfFrames: 1
                                  Rows: 1
                               Columns: 1
                         DataPointRows: 1
                      DataPointColumns: 2048
                   SignalDomainColumns: 'TIME'
                    DataRepresentation: 'COMPLEX'
       PerformedProcedureStepStartDate: '20240626'
       PerformedProcedureStepStartTime: '144900.300000'
         PerformedProcedureStepEndDate: '20240626'
              PerformedProcedureStepID: 'SI365c36e5eafc4d'
     PerformedProcedureStepDescription: '223 LEV Synaptic_Connectivity'
             RequestAttributesSequence: [1×1 struct]
            AcquisitionContextSequence: [1×1 struct]
      IssueDateOfImagingServiceRequest: '20240626'
        SharedFunctionalGroupsSequence: [1×1 struct]
      PerFrameFunctionalGroupsSequence: [1×1 struct]
                      SpectroscopyData: [4096×1 single]
And here is the tag PerFrameFunctionalGroupsSequence.Item_1_Private_0021_10fe:

I couldn’t extract tags using niftiinfo as I got an error saying The specified image data type is not supported..


And as for the sidecar files:

Both problematic dicom scans are on the same repository. It’s 223 MRI2 and 217 MRI1. Both happen to be from the new Siemens software version.

Hi Julia,
I’m a little confused. For your proband 223, in the dicom file you have at (0021,1059) (0,0,22) and in the sidecar file (0,0,43) and in other fields, there are also differences. Are these two different measurements? In the sidecar, I have a studydate of 20240703 and in the dicom header 20240626.

Heiner

Hi Heiner,
sorry, yes these are two different scans. I should have selected MRI2, not MRI1 (as MRI2 is the one I mentioned is having issues with voxel placement).

Here is the output (MRI2)

                              Filename: '/data/project/SV2A_MC1/LEV/sourcedata/sub-223/ses-MRI2/20-ACC_svs_se_30_noECC/resources/secondary/2.25.32491572345396840739318711101525313657-20-1-anwtlt.dcm'
                           FileModDate: '05-Aug-2024 09:41:00'
                              FileSize: 116584
                                Format: 'DICOM'
                         FormatVersion: 3
                                 Width: 1
                                Height: 1
                              BitDepth: []
                             ColorType: ''
        FileMetaInformationGroupLength: 174
            FileMetaInformationVersion: [2×1 uint8]
               MediaStorageSOPClassUID: '1.2.840.10008.5.1.4.1.1.4.2'
            MediaStorageSOPInstanceUID: '2.25.256577899615104464943943200131520304722'
                     TransferSyntaxUID: '1.2.840.10008.1.2.1'
                ImplementationClassUID: '1.2.40.0.13.1.1'
             ImplementationVersionName: 'dcm4che-2.0'
                  SpecificCharacterSet: 'ISO_IR 100'
                             ImageType: 'ORIGINAL\PRIMARY\SPECTROSCOPY\NONE'
                           SOPClassUID: '1.2.840.10008.5.1.4.1.1.4.2'
                        SOPInstanceUID: '2.25.256577899615104464943943200131520304722'
                             StudyDate: '20240703'
                            SeriesDate: '20240703'
                           ContentDate: '20240703'
                   AcquisitionDateTime: '20240703133314.540000'
                             StudyTime: '131848.400000'
                            SeriesTime: '133803.344000'
                           ContentTime: '133803.348000'
                       AccessionNumber: '2.25.290070988920337595058960832122557831312'
                              Modality: 'MR'
                          Manufacturer: 'Siemens Healthineers'
                      StudyDescription: '223 Placebo Synaptic_Connectivity'
                     SeriesDescription: 'ACC_svs_se_30_noECC'
               PerformingPhysicianName: [1×1 struct]
                 ManufacturerModelName: 'MAGNETOM Prisma'
       ReferencedImageEvidenceSequence: [1×1 struct]
                  VolumetricProperties: 'DISTORTED'
       VolumeBasedCalculationTechnique: 'NONE'
                 ComplexImageComponent: 'COMPLEX'
                   AcquisitionContrast: ''
             Private_0009_10xx_Creator: 'SIEMENS SYNGO INDEX SERVICE'
                     Private_0009_108c: ''
                           PatientName: [1×1 struct]
                             PatientID: '223_Placebo'
                            PatientSex: 'M'
                            PatientAge: '056Y'
                           PatientSize: 1.7780
                         PatientWeight: 77
                DeidentificationMethod: 'RSU XNAT Migration Anonymisation'
    DeidentificationMethodCodeSequence: [1×1 struct]
                      BodyPartExamined: 'HEAD'
                 MagneticFieldStrength: 3
                    DeviceSerialNumber: '166001'
                      SoftwareVersions: 'syngo MR XA30'
                          ProtocolName: 'ACC_svs_se_30'
                     SpatialResolution: 1
                 DateOfLastCalibration: '20090304'
                 TimeOfLastCalibration: '123723'
                                 B1rms: 0.4742
                       PatientPosition: 'HFS'
                  ContentQualification: 'PRODUCT'
                     PulseSequenceName: '*svs_se'
                     EchoPulseSequence: 'SPIN'
                      MultipleSpinEcho: 'NO'
                 MultiPlanarExcitation: 'NO'
              SteadyStatePulseSequence: 'NONE'
               EchoPlanarPulseSequence: 'NO'
         SpectrallySelectedSuppression: 'NONE'
             GeometryOfKSpaceTraversal: 'RECTILINEAR'
              SegmentedKSpaceTraversal: 'SINGLE'
      RectilinearPhaseEncodeReordering: 'LINEAR'
                         SpectralWidth: 2500
                ChemicalShiftReference: 4.7000
           VolumeLocalizationTechnique: 'PRESS'
                            Decoupling: 'NO'
                       KSpaceFiltering: 'NONE'
                   TimeDomainFiltering: 'NONE'
                     NumberOfZeroFills: 0
                    BaselineCorrection: 'NONE'
                   AcquisitionDuration: 288
            NumberOfKSpaceTrajectories: 96
                  TransmitterFrequency: 123.2563
                       ResonantNucleus: '1H'
                   FrequencyCorrection: 'NO'
            VolumeLocalizationSequence: [1×1 struct]
        ApplicableSafetyStandardAgency: 'IEC'
             FirstOrderPhaseCorrection: 'NO'
        WaterReferencedPhaseCorrection: 'NO'
         MRSpectroscopyAcquisitionType: 'SINGLE_VOXEL'
                      StudyInstanceUID: '2.25.32491572345396840739318711101525313657'
                     SeriesInstanceUID: '2.25.281001225998221136498368569177969505290'
                          SeriesNumber: 20
                     AcquisitionNumber: 1
                        InstanceNumber: 1
                   FrameOfReferenceUID: '2.25.183037375415414858825769564518733185486'
            PositionReferenceIndicator: ''
         DimensionOrganizationSequence: [1×1 struct]
                DimensionIndexSequence: [1×1 struct]
             Private_0021_10xx_Creator: 'SIEMENS MR MRS 05'
             Private_0021_11xx_Creator: 'SIEMENS MR SDR 01'
                     Private_0021_1001: 300.5098
                     Private_0021_1101: 'ACQUISITION'
                     Private_0021_1102: 'ACQUISITION'
                        NumberOfFrames: 1
                                  Rows: 1
                               Columns: 1
                         DataPointRows: 1
                      DataPointColumns: 2048
                   SignalDomainColumns: 'TIME'
                    DataRepresentation: 'COMPLEX'
       PerformedProcedureStepStartDate: '20240703'
       PerformedProcedureStepStartTime: '131848.400000'
         PerformedProcedureStepEndDate: '20240703'
              PerformedProcedureStepID: 'USa47e067974314b'
     PerformedProcedureStepDescription: '223 Placebo Synaptic_Connectivity'
            AcquisitionContextSequence: [1×1 struct]
      IssueDateOfImagingServiceRequest: '20240703'
        SharedFunctionalGroupsSequence: [1×1 struct]
      PerFrameFunctionalGroupsSequence: [1×1 struct]
                      SpectroscopyData: [4096×1 single]
And here is the other data (MRI2)

I have managed to run it with nifti files recently but with some workarounds.

  1. I select no PDF output in the job file (per errors mentioned here)
  2. I have to specify the basis file, because unlike with dicoms it can no longer identify the right one automatically.
  3. When it gets to coregistration and segmentation I get an error about unknown vendor so I just type MRSCont.vendor = 'Siemens'; in the terminal and then I continue running the script with:
    MRSCont = OspreyCoreg(MRSCont);
    MRSCont = OspreySeg(MRSCont);
    

It’s not the most optimal but using nifti files does place the voxels in correct locations, so at least it works.

Hi Julia,
good to hear that you have found a solution. The interesting difference between NIfTI and DICOM is the mid slab position. For DICOM, you have [8.18,-87.9,-30.4] and for NIfTI [8.18,-87.9,12.6]. When you convert your data from DICOM to NIfTI, the table position has been taken into account. To your third point, your manufacturer in the sidecar is ‘Siemens Healthineers’, but the data will only be loaded correctly if the manufacturer is ‘siemens’ (see osp_LoadNII line 250). That should be easy for the Osprey team to solve (@admin,@Helge). You can also try to replace ‘siemens’ with {‘siemens’,‘Siemens Healthineers’} to solve this problem for your own.