QSIprep ERROR "AttributeError: Can only use .str accessor with string values!"

Summary of what happened:

Dear Experts,
I’m trying to preprocess DWIs using QSIprep, but I encountered the following error at the beginning.

AttributeError: Can only use .str accessor with string values!

How should I address this error? I would be grateful for your advice.

Command used (and if a helper script was used, a link to the helper script or the command generated):

qsiprep-docker /bids_root_dir /output_dir participant --participant-label N0001 --output-resolution 2 --skip-bids-validation

Version:

QSIprep 0.19.1

Environment (Docker, Singularity, custom installation):

Docker

Screenshots / relevant information:

Hi @Printemps,

Please remove —skip-bids-validation from your command and share the BIDS validation report with us. Also please try specifying a working directory with the -w flag that is outside the BIDS directory.

Best,
Steven

Thank you @Steven ,

I retried removing --skip-bids-validation, and the following message was shown.
Indeed, our BIDS directory includes resting-state fMRIs in the “func”, and the JSON file for it does not have the slice timing information because it was acquired with a PHILIPS scanner. However, could the incompleteness of other images possibly affect the processing of DWIs?

1: [WARN] You should define ‘SliceTiming’ for this file. If you don’t provide this information slice time correction will not be possible. (code: 13 - SLICE_TIMING_NOT_DEFINED)
./sub-N0001/func/sub-N0001_task-rest_bold.nii.gz

2: [WARN] The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered based on the presence of only one author field. Please ignore if all contributors are already properly listed. (code: 102 - TOO_FEW_AUTHORS)

Also, I set the working directory as in /home/qsiprep with -w flag, but the error message (AttributeError: Can only use .str accessor with string values!) was shown again.

Thank you for your time.

Looks like the error is happening here:


Please return the contents of your DWI JSON files. It would help if you paste the contents as text surrounded by tick marks so it is formatted nicely

like this

(you can highlight the text and press the </> button to add those tickmarks or just use the ` key)

Best,
Steven

Dear @Steven

Thank you for your reply.
Our DWI JSON file is below.

{
    "Modality": "MR",
    "MagneticFieldStrength": 3,
    "ImagingFrequency": 127.765,
    "Manufacturer": "Philips",
    "ManufacturersModelName": "Achieva dStream",
    "InstitutionName": "TohokuUniv.BrainDynamicStudy",
    "InstitutionalDepartmentName": "Rediology",
    "DeviceSerialNumber": "17556",
    "StationName": "mrhostx",
    "BodyPartExamined": "BRAIN",
    "PatientPosition": "HFS",
    "SoftwareVersions": "5.7.1\\5.7.1.3",
    "MRAcquisitionType": "2D",
    "SeriesDescription": "DTI Jones30_a",
    "ProtocolName": "DTI Jones30_a",
    "ScanningSequence": "SE",
    "SequenceVariant": "SK",
    "ScanOptions": "FS",
    "PulseSequenceName": "DwiSE",
    "ImageType": [
        "ORIGINAL",
        "PRIMARY",
        "M",
        "SE",
        "M",
        "SE"
    ],
    "SeriesNumber": 701,
    "AcquisitionTime": "18:28:53.210000",
    "AcquisitionNumber": 7,
    "PhilipsRWVSlope": 0.82442,
    "PhilipsRWVIntercept": 0,
    "PhilipsRescaleSlope": 0.82442,
    "PhilipsRescaleIntercept": 0,
    "PhilipsScaleSlope": 0.0267161,
    "UsePhilipsFloatNotDisplayScaling": 1,
    "SliceThickness": 2,
    "SpacingBetweenSlices": 2,
    "SAR": 0.0606958,
    "EchoTime": 0.08,
    "RepetitionTime": 10,
    "MTState": false,
    "FlipAngle": 90,
    "CoilString": "MULTI COIL",
    "PercentPhaseFOV": 100,
    "PercentSampling": 100,
    "EchoTrainLength": 55,
    "PartialFourierDirection": "PHASE",
    "PartialFourierEnabled": "YES",
    "PhaseEncodingStepsNoPartialFourier": 110,
    "AcquisitionMatrixPE": 110,
    "ReconMatrixPE": 112,
    "ParallelReductionFactorInPlane": 2,
    "ParallelAcquisitionTechnique": "SENSE",
    "WaterFatShift": 13.7088,
    "EstimatedEffectiveEchoSpacing": 0.00027923,
    "EstimatedTotalReadoutTime": 0.0309945,
    "AcquisitionDuration": 330,
    "PixelBandwidth": 2570,
    "PhaseEncodingAxis": "j",
    "ImageOrientationPatientDICOM": [
        0.997373,
        0.0279108,
        0.0668486,
        -0.0293151,
        0.999368,
        0.0201182
    ],
    "InPlanePhaseEncodingDirectionDICOM": "COL",
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20220720",
    "Dcm2bidsVersion": "2.1.7"
}

Hi @Printemps,

Thanks for sharing. Your data are missing the PhaseEncodingDirection field (often missing in Phillips scanners). On your dir-AP scan try adding "PhaseEncodingDirection": "j-" and on your dir-PA scan try adding "PhaseEncodingDirection": "j".

Best,
Steven

2 Likes

Thank you @Steven
I added “PhaseEncodingDirection” for dir-AP and dir-PA images, and finally, QSIprep started normally!
I sincerely appreciate your kindness.

Best,

1 Like

Great, happy to hear! Make sure you look at the HTML at the end to make sure the susceptibility distortion correction worked as intended.

We should add a better error message for this in qsiprep, the current message is not helpful at all