Using ImageJ as a plugin for mass image analysis
3 ビュー (過去 30 日間)
古いコメントを表示
I am currently trying to use ImageJ as a plug-in where I can open a file and have the script apply certain settings to it (Image>Adjust>Color Threshold> Color Threshold: B&W, Brightness = 75). I've been able to open the image, but I'm having trouble applying the settings I want. The "Apply" command isn't working and I am running out of ideas. I've attached the code below. Can anyone help?
javaaddpath('C:\Program Files\MATLAB\R2023b\java\mij.jar');
javaaddpath('C:\Program Files\MATLAB\R2023b\java\ij.jar');
MIJ.start;
% Browse for the JPEG or TIFF file
[filename, filepath] = uigetfile('*.*');
imagePath = fullfile(filepath, filename);
% Open the image using MIJ
MIJ.run('Open...', ['path=[' imagePath ']']);
% Open the Color Threshold dialog
MIJ.run('Color Threshold...');
% Set color space to B&W
MIJ.run('Set... ', ['thresholded color=B&W']);
% Close the Color Threshold dialog (applies the changes)
MIJ.run('Close');
0 件のコメント
回答 (1 件)
Rahul
2025 年 4 月 8 日
I understand that you wish to apply color threshold to your image and are not able to "Apply" it while running the MIJ.run('Close') command. The following command can be used to apply the required threshold:
MIJ.run('Convert to Mask');
% After this commmand to close tha pplication run
MIJ.run('Close All');
The following MATLAB Answer and File Exchange submission can be referred to know more about MIJ commands in MATLAB:
https://www.mathworks.com/matlabcentral/fileexchange/47545-mij-running-imagej-and-fiji-within-matlab
Thanks.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!