Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: 'niftiread' undefined near line 21, column 21 #335

Open
hbhutta opened this issue Nov 19, 2024 · 0 comments
Open

error: 'niftiread' undefined near line 21, column 21 #335

hbhutta opened this issue Nov 19, 2024 · 0 comments

Comments

@hbhutta
Copy link

hbhutta commented Nov 19, 2024

I know that niftiread was released in Matlab version R2017b and it's a function in the core library. I am not familiar with Octave, all I know that is that Matlab files can be run in octave. Why I am I getting the above error?

function resize_nifti(input_dir, file_pattern)
    files_to_scale = dir(fullfile(input_dir, file_pattern));
    disp(files_to_scale);
    scale_factor = 2;

    path = fullfile(files_to_scale.folder, files_to_scale.name);
    disp(path);

    %  Originally scale_nifti function, put in here instead to have one function per file
    disp("Scaling NIFTI file");
    r = niftiread(path);
    r_s = imresize3(r, scale_factor);
    [path, name, ~] = fileparts(path);
    save_path = fullfile(path, strcat(name, "_scaled.nii"));
    disp(save_path);
    niftiwrite(r_s, save_path);
end

All the disp statements execute and everything works fine up to the line disp("Scaling NIFTI file"), as soon as the niftiread statement is reached I get the above error. Do I need to somehow "import" niftiread? I'm guessing not since it should be built in. Or maybe the octave version I am using does not correspond to at least Matlab version R2017b. Is this the case?

Any ideas would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant