Cannot open file anymore when converting Nifti to DICOM
Show older comments
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 '\00501_3D_TSE_0.7mm\00001.dcm --sagittal ' '--series-description LmSTN '];
statusNiftiToDicom = system( cmdNiftiToDicom );
cmdNiftiToDicom = ['niftitodicom.exe -o' patientFolder '\RmSTN ' patientFolder '\7T2LRmSTN.nii.gz ' patientFolder '\00501_3D_TSE_0.7mm\00001.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.
Accepted Answer
More Answers (0)
Categories
Find more on Medical Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!