Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- % Add the Bio-Formats toolbox to MATLAB's Java classpath
- bioFormatsPath = 'C:\Users\rocke\Downloads\MathWorks\bfmatlab\bfmatlab\bfmatlabbioformats_package.jar';
- javaaddpath(bioFormatsPath);
- % Use Bio-Formats to read the OME file
- disp('Attempting to read OME file...');
- data = bfopen(omeFilePath);
- disp('OME file read successfully.');
- % Extract the image data from the Bio-Formats structure
- omeImage = data{1}{1};
- % Define the desired width and height for the resized image
- desiredWidth = 800;
- desiredHeight = 600;
- % Resize the image to the desired dimensions
- resizedImage = imresize(omeImage, [desiredHeight, desiredWidth]);
- % Specify the output TIFF file path
- tiffFilePath = 'K:\SlideScans_AstroPath_Test\HumanTB\newfile.tif';
- % Save the resized image as a TIFF file
- imwrite(resizedImage, tiffFilePath);
- % Display a success message
- fprintf('OME file converted to TIFF: %s\n', tiffFilePath);
- catch exception
- % Handle any errors that may occur during the process
- fprintf('An error occurred: %s\n', exception.message);
- disp(exception.getReport);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement