Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ To see some examples, have a look at the tutorial directory. If you want to read
Note: This repository was formerly ISET3d-v4, pbrt2iset, and before that we relied on RenderToolbox4.

ISET3d was originally developed in Brian Wandell's [Vistalab group](https://vistalab.stanford.edu/) at [Stanford University](stanford.edu), along with co-contributors from other research institutions and industry.

## Octave Support
- July 14, 2025: Ayush Jamdar.
- New: A function `isOctave` tests if code is being run in Octave and uses modified code accordingly.
- The EXR readers come from OpenEXR and accept only the filename as input.
- We still rely on `.mex` exr io functions but those are built using `mkoctfile`. See `isetcam/imgproc/openexr`
- We have tested `isethdrsensor/scripts/fullSimulation.m` on examples from the ISET HDR dataset using Octave 6.4.0.
- Refer to `isetcam/README.md` for Octave and Conda environment packages.
14 changes: 14 additions & 0 deletions utilities/isOctave.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
% Test if running in Octave

% This function will be called whenever code differs between
% Matlab and Octave, with the goal to extend ISET support

function retval = isOctave
persistent cacheval;
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end


37 changes: 26 additions & 11 deletions utilities/pbrt/pbrt-v4/piEXR2ISET.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
nn = nn+1;
end
try
% New format
% New format: exrread() either from Matlab or Openexr
energy = exrread(inputFile,Channels = radianceChannels);
catch
% keep the old format
Expand All @@ -109,16 +109,31 @@

case {'depth', 'zdepth'}
info = exrinfo(inputFile);
channelNames = info.ChannelInfo.Properties.RowNames;
if contains('P.X',channelNames)
% Modern naming for X,Y,Z coordinates
coordinates = exrread(inputFile,Channels=["P.X","P.Y","P.Z"]);
elseif contains('Px',channelNames)
% Historical naming
coordinates = exrread(inputFile,Channels=["Px","Py","Pz"]);
else
warning('No X,Y,Z channels found. Returning.');
return;

if isOctave()
channelNames = info.channels;
if any(strcmp('P.X', channelNames))
% Modern naming for X,Y,Z coordinates
coordinates = exrread(inputFile);
elseif any(strcmp('Px', channelNames))
% Historical naming
coordinates = exrread(inputFile);
else
warning('No X,Y,Z channels found. Returning.');
return;
end
else % Matlab
channelNames = info.ChannelInfo.Properties.RowNames;
if contains('P.X',channelNames)
% Modern naming for X,Y,Z coordinates
coordinates = exrread(inputFile,Channels=["P.X","P.Y","P.Z"]);
elseif contains('Px',channelNames)
% Historical naming
coordinates = exrread(inputFile,Channels=["Px","Py","Pz"]);
else
warning('No X,Y,Z channels found. Returning.');
return;
end
end

if isequal(label{ii},'depth')
Expand Down
19 changes: 14 additions & 5 deletions utilities/pbrt/pbrt-v4/piEXR2Mat.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@
% dockerWrapper Support, D. Cardinal, 2022
%

% Check if MATLAB exrread() is available
% This function is available only in Matlab >= R2022b
hasBuiltinExrread = false;
if ~isOctave() && exist('isMATLABReleaseOlderThan', 'file') > 0
hasBuiltinExrread = ~isMATLABReleaseOlderThan('R2022b');
end

% tic
if exist('isMATLABReleaseOlderThan','file') > 0 && ~isMATLABReleaseOlderThan('R2022b')
if hasBuiltinExrread
% Use Matlab builtin exrread from the image toolbox

% Matlab included exrread() in 2022b. We included exread() in
Expand Down Expand Up @@ -48,9 +55,11 @@
data = exrread(inputFile, Channels = channels);
return;

elseif isfile(fullfile(isetRootPath,'imgproc','openexr','exrread.m'))

% Use the exrread() from ISETCam.
elseif isfile(fullfile(isetRootPath,'imgproc','openexr','exrreadchannels.mex'))
% If Matlab's exrread() isn't available, the user must be using
% openexr's exrread() (either from older Matlab or Octave)
% In this case, the mex file should exist
% Note that this file reader uses arguments different from Matlab's

if strcmpi(channelname,'radiance')
channels = cell(1,31);
Expand Down Expand Up @@ -95,7 +104,7 @@

if status
disp(result);
error('EXR to Binary conversion failed.')
error('EXR to Binary conversion failed.');
end
allFiles = dir([indir,sprintf('/%s_*',fname)]);
fileList = [];
Expand Down