Cannot open file anymore when converting Nifti to DICOM
I have a script where I convert MRI nifti files to DICOM. This used to work but now I get an error when trying to create a new folder and saving the converted files into that folder:
First steps work (Part I):
%% load data
% REVISIT – adapt all text between ‘apostrophes’
patientID = ‘patient180’; % this is the folder with the specific patient data
patientIn = fullfile(‘7Tseg_Brainlab’, patientID); % this is the folder where the patient folders are in
patientFolder = fullfile… % this is the whole path to the patientIn folder
(‘here is whole path’,patientIn);
addpath(genpath(patientIn));
dicom_template = ‘00501_3D_TSE_0.7mm’; % this is the original dicom that is used for the new dicom header
Then with this part I get an error (Part II):
% note: the [space] before the second ‘ after the names is necessary,
% otherwise you will get an error
cmdNiftiToDicom = [‘niftitodicom.exe -o’ patientFolder ‘LmSTN ‘ patientFolder ‘7T2LRmSTN.nii.gz ‘ patientFolder ‘0501_3D_TSE_0.7mm0001.dcm –sagittal ‘ ‘–series-description LmSTN ‘];
statusNiftiToDicom = system( cmdNiftiToDicom );
cmdNiftiToDicom = [‘niftitodicom.exe -o’ patientFolder ‘RmSTN ‘ patientFolder ‘7T2LRmSTN.nii.gz ‘ patientFolder ‘0501_3D_TSE_0.7mm0001.dcm –sagittal ‘ ‘–series-description RmSTN ‘];
statusNiftiToDicom = system( cmdNiftiToDicom);
So what I want is 2 folders, named ‘LmSTN’ and ‘RmSTN’. This used to work and now I get the error saying ‘Cannot open file’, but I do use the correct path.I have a script where I convert MRI nifti files to DICOM. This used to work but now I get an error when trying to create a new folder and saving the converted files into that folder:
First steps work (Part I):
%% load data
% REVISIT – adapt all text between ‘apostrophes’
patientID = ‘patient180’; % this is the folder with the specific patient data
patientIn = fullfile(‘7Tseg_Brainlab’, patientID); % this is the folder where the patient folders are in
patientFolder = fullfile… % this is the whole path to the patientIn folder
(‘here is whole path’,patientIn);
addpath(genpath(patientIn));
dicom_template = ‘00501_3D_TSE_0.7mm’; % this is the original dicom that is used for the new dicom header
Then with this part I get an error (Part II):
% note: the [space] before the second ‘ after the names is necessary,
% otherwise you will get an error
cmdNiftiToDicom = [‘niftitodicom.exe -o’ patientFolder ‘LmSTN ‘ patientFolder ‘7T2LRmSTN.nii.gz ‘ patientFolder ‘0501_3D_TSE_0.7mm0001.dcm –sagittal ‘ ‘–series-description LmSTN ‘];
statusNiftiToDicom = system( cmdNiftiToDicom );
cmdNiftiToDicom = [‘niftitodicom.exe -o’ patientFolder ‘RmSTN ‘ patientFolder ‘7T2LRmSTN.nii.gz ‘ patientFolder ‘0501_3D_TSE_0.7mm0001.dcm –sagittal ‘ ‘–series-description RmSTN ‘];
statusNiftiToDicom = system( cmdNiftiToDicom);
So what I want is 2 folders, named ‘LmSTN’ and ‘RmSTN’. This used to work and now I get the error saying ‘Cannot open file’, but I do use the correct path. I have a script where I convert MRI nifti files to DICOM. This used to work but now I get an error when trying to create a new folder and saving the converted files into that folder:
First steps work (Part I):
%% load data
% REVISIT – adapt all text between ‘apostrophes’
patientID = ‘patient180’; % this is the folder with the specific patient data
patientIn = fullfile(‘7Tseg_Brainlab’, patientID); % this is the folder where the patient folders are in
patientFolder = fullfile… % this is the whole path to the patientIn folder
(‘here is whole path’,patientIn);
addpath(genpath(patientIn));
dicom_template = ‘00501_3D_TSE_0.7mm’; % this is the original dicom that is used for the new dicom header
Then with this part I get an error (Part II):
% note: the [space] before the second ‘ after the names is necessary,
% otherwise you will get an error
cmdNiftiToDicom = [‘niftitodicom.exe -o’ patientFolder ‘LmSTN ‘ patientFolder ‘7T2LRmSTN.nii.gz ‘ patientFolder ‘0501_3D_TSE_0.7mm0001.dcm –sagittal ‘ ‘–series-description LmSTN ‘];
statusNiftiToDicom = system( cmdNiftiToDicom );
cmdNiftiToDicom = [‘niftitodicom.exe -o’ patientFolder ‘RmSTN ‘ patientFolder ‘7T2LRmSTN.nii.gz ‘ patientFolder ‘0501_3D_TSE_0.7mm0001.dcm –sagittal ‘ ‘–series-description RmSTN ‘];
statusNiftiToDicom = system( cmdNiftiToDicom);
So what I want is 2 folders, named ‘LmSTN’ and ‘RmSTN’. This used to work and now I get the error saying ‘Cannot open file’, but I do use the correct path. nifti, dicom MATLAB Answers — New Questions