フィルターのクリア

How to open OIR files through ImageJ in MATLAB?

23 ビュー (過去 30 日間)
Etash
Etash 2024 年 1 月 23 日
コメント済み: Etash 2024 年 1 月 24 日
I seek to use MATLAB to help me batch process a folder of OIR files with ImageJ. Conventionally, these OIR files can open directly in ImageJ (by dragging and dropping).
To use MATLAB, I first put the mij.jar and ij.jar (ImageJ) into the java directory of MATLAB, and I subsequently added them to the classpath.
The command MIJ.start properly starts ImageJ. However, my code doesn't open my image when I say:
function results = ImageJ_Test
javaaddpath('/Applications/MATLAB_R2021b.app/java/ij146r.jar');
javaaddpath('/Applications/MATLAB_R2021b.app/java/mij.jar');
% Start MIJ (initialize ImageJ in MATLAB)
MIJ.start;
% Define the path to the folder containing the images
folderPath = '/Users/Documents/Test';
% Get a list of all image files in the folder
imageFiles = dir(fullfile(folderPath, '**', '*.oir')); % Since the images are OIR files
% Loop through each image file in the folder
for i = 1:numel(imageFiles)
% Construct the full file path for the current image
imagePath = fullfile(folderPath, imageFiles(i).name);
address = append('path=[',imagePath,']');
% Open the current image in ImageJ
MIJ.run('Open...', address);
The MIT.run('Open...', address) isn't properly opening the file, and it is instead opening as a jumble of letters and characters instead of a proper image. I was wondering whether there is something I can do to make ImageJ open my OIR file correctly as an image instead of characters.
Thank you so much!
  2 件のコメント
Walter Roberson
Walter Roberson 2024 年 1 月 23 日
imagePath = fullfile(folderPath, imageFiles(i).name);
That should be
imagePath = fullfile(imageFiles(i).folder, imageFiles(i).name);
The current code would work only if all of the oir files are directly underneath the folderPath
Etash
Etash 2024 年 1 月 24 日
Thank you so much!

サインインしてコメントする。

回答 (0 件)

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by