[Nirfast] Failing while trying to graphically place sources/detectors

Stanislaw Wojtkiewicz s.wojtkiewicz at cs.bham.ac.uk
Wed May 9 17:41:45 EDT 2018


Hi Karthik

 

I can confirm, the newest Matlab does not like some functions used in NIRFAST.

 

The very last issue:

“Error using matlab.graphics.axis.Axes/get
There is no x_RenderTransform property on the Axes class.”

MathWorks removed the ‘x_RenderTransform’ axes property starting with Matlab R2014a. More community comments about that here: https://undocumentedmatlab.com/blog/undocumented-view-transformation-matrix

 

No easy fix of that (the GUI of source/detector placing might require some refurbishment).

 

However, I might have a solution for you.

 

Here is how to add source/detector manually (using Matlab commands). Step by step:

 

#0

Do not place points using a mouse.

 

#1

@ the left side of the GUI where you have empty lists of sources and detectors: put some values in both. E.g. 

1 2 3

2 4 5

For (x y z) coordinates of e.g. 2 sources. Do similar with detectors.

The 'points placing' with a mouse just reads the (x y z) coordinates from the figure axes and puts them into the lists. You might try to put the exact coordinates if you know them.

#2

Save the mesh from the GUI. Step #1 is not necessary. You should be able to save mesh without fiducial points. However, you will have more work later :)

#3

Load the mesh in Matlab command window, script, etc.. using the ‘load_mesh’ function (mesh = load_mesh(‘path_to_mesh/mesh_name’);)

#4

Adjust your sources and detector.

The mesh structure should have following fields:

            source: [1×1 struct]

              meas: [1×1 struct]

 

e.g.

>> mesh.source

 

ans = 

 

  struct with fields:

 

    distributed: 0

          fixed: 0

            num: 1

          coord: [47.0244 59.5354 48.0170]

           fwhm: 0

 

and 

 

>> mesh.meas

 

ans = 

 

  struct with fields:

 

       fixed: 0

         num: [2×1 double]

       coord: [2×3 double]

    int_func: [2×5 double]

 

Look for the fields meaning on the online documentation. Focus on: coordinates (coord) and numbering (num).

 

#5

Change the mesh.link field accordingly (using your sources and detectors numbering). The ‘link’ field is explained somewhere online. It is basically a list of source and detector numbers and logical indicator (0, 1) if this pair is considered as active (if the boundary fluence rate should be calculated for that pair).

 

#6

Save the mesh using the command ‘save_mesh(mesh, ‘path_2_mesh/mesh_name’)’

 

#7

Enjoy the mesh.

The source/detector coordinates do not have to be exactly on the mesh surface. Try to put them close to the surface. The load_mesh function will take care of proper positioning if you leave the ‘fixed’ field set to ‘0’.

 

I hope I helped.

 

 

 

Regards

Stanislaw Wojtkiewicz, PhD

 

---

School of Computer Science

University of Birmingham

B15 2TT

 

From: Vishwanath, Karthik <vishwak at miamioh.edu> 
Sent: 09 May 2018 19:15
To: nirfast at public.kitware.com
Subject: [Nirfast] Failing while trying to graphically place sources/detectors

 

Hi All,

Was having trouble creating and placing sources/detectors in a standard slab mesh using NIRFAST-9.0 on a linux system (Ubuntu 16.04.4 LTS; 4.4.0-122-generic x86_64 kernel). My MATLAB version is R2017a. 

I've listed sequence of steps with the messages in the workspace window shown and the fixes I attempted (in blue text) 

==================================================

>> nirfast

Selected menu in GUI: Mesh->Create Mesh ->Simple Shapes -> Standard

Selected slab and set L/W/H to 20mm and click Done

Error using textscan
Unknown parameter 'bufsize'.

Error in read_nod_elm (line 45)
        data = textscan(fid,'%u32 %f %f %f%*[^\n]','bufsize',409500);

Error in checkerboard3d_mm (line 109)
    [telem tnode] = read_nod_elm(fnprefix,1);

Error in make_slab (line 89)
    mesh = checkerboard3d_mm(fullfile(outputdir,'test_node_ele.ele'),...


Error in create_mesh (line 25)
    eval(['mesh = make_' lower(shape) '(sizevar);']);

Error in gui_create_mesh>done_Callback (line 532)
    mesh = evalin('base',content{end});

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in gui_create_mesh (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_create_mesh('done_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.



==================================================

Changed line 45 in "toolbox/meshing/tools/read_nod_elm.m" to: data = textscan(fid,'%u32 %f %f %f%*[^\n]')


Selected menu in GUI: Mesh->Create Mesh ->Simple Shapes -> Standard

Selected slab and set L/W/H to 20mm and click Done

 

Added Shield: 0.0010 s
Delaunay Triangulation Time: 0.7141 s
Connectivity Time: 0.0359 s
Circumcenters Time: 0.0129 s
  47 th level was reached
100.0000 % of Tetraedroms were checked
Walking Time: 0.0399 s
Manifold extraction Time: 0.4239 s
Total Time: 1.2299 s
Writing data to file...Done writing mesh to:
    Path: /home/karthik/Research/Matlab/lib/nirfast
    Filename: test_node_ele.node/.ele


--> Beginning mesh generation process, please wait...
    Done with sub-volume separation.
===========================================
    Calculating desired length at boundary nodes.. done.
    Calculating prism normals and bounding boxes.. done.
    Sealing boundary buffer zone.. done.

     Tagging interior nodes... done
-----> Running BSP tree to filter out nodes.

-----> done.
Writing data to file.Done writing the nodes to:
    Path: /tmp
    Filename: input4delaunay.a.node

Writing data to file... Done writing surface to a poly file:
    Path: /tmp
    Filename: input4delaunay.poly

---------> Running Delaunay, please wait.../bin/bash: /home/karthik/Research/Matlab/lib/nirfast/NIRFAST-9.0/toolbox/meshing/bin/delaunaygen-linux64.exe: Permission denied
Warning:  Delaunay Generator failed. Trying again... 
> In checkerboard3d (line 181)
  In checkerboard3d_mm (line 167)
  In make_slab (line 89)
  In create_mesh (line 25)
  In gui_create_mesh>done_Callback (line 532)
  In gui_mainfcn (line 95)
  In gui_create_mesh (line 42)
  In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_create_mesh('done_Callback',hObject,eventdata,guidata(hObject)) 
/bin/bash: /home/karthik/Research/Matlab/lib/nirfast/NIRFAST-9.0/toolbox/meshing/bin/delaunaygen-linux64.exe: Permission denied
Error using checkerboard3d (line 186)
 Delaunay Generator failed again. Check your input setting!

Error in checkerboard3d_mm (line 167)
[mesh.elements, mesh.nodes] = checkerboard3d(telem(:,1:3),tnode,myargs);

Error in make_slab (line 89)
    mesh = checkerboard3d_mm(fullfile(outputdir,'test_node_ele.ele'),...


Error in create_mesh (line 25)
    eval(['mesh = make_' lower(shape) '(sizevar);']);

Error in gui_create_mesh>done_Callback (line 532)
    mesh = evalin('base',content{end});

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in gui_create_mesh (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_create_mesh('done_Callback',hObject,eventdata,guidata(hObject)) 
Error while evaluating UIControl Callback.

==================================================

In shell:

$ chmod +x /home/karthik/Research/Matlab/lib/nirfast/NIRFAST-9.0/toolbox/meshing/bin/delaunaygen-linux64.exe

 

Selected menu in GUI: Mesh->Create Mesh ->Simple Shapes -> Standard

Selected slab and set L/W/H to 20mm and click Done

 

Added Shield: 0.0003 s
Delaunay Triangulation Time: 0.4179 s
Connectivity Time: 0.0214 s
Circumcenters Time: 0.0032 s
Warning: Brute continuation necessary 
> In MyRobustCrust>Marking (line 408)
  In MyRobustCrust (line 134)
  In make_slab (line 85)
  In create_mesh (line 25)
  In gui_create_mesh>done_Callback (line 532)
  In gui_mainfcn (line 95)
  In gui_create_mesh (line 42)
  In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_create_mesh('done_Callback',hObject,eventdata,guidata(hObject)) 
Warning: 1000 th level was reached\n 
> In MyRobustCrust>Marking (line 440)
  In MyRobustCrust (line 134)
  In make_slab (line 85)
  In create_mesh (line 25)
  In gui_create_mesh>done_Callback (line 532)
  In gui_mainfcn (line 95)
  In gui_create_mesh (line 42)
  In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_create_mesh('done_Callback',hObject,eventdata,guidata(hObject)) 
99.7824 % of Tetraedroms were checked
Walking Time: 0.0985 s
Manifold extraction Time: 0.2470 s
Total Time: 0.7971 s
Writing data to file...Done writing mesh to:
    Path: /home/karthik/Research/Matlab/lib/nirfast
    Filename: test_node_ele.node/.ele


--> Beginning mesh generation process, please wait...
    Done with sub-volume separation.
===========================================
    Calculating desired length at boundary nodes.. done.
    Calculating prism normals and bounding boxes.. done.
    Sealing boundary buffer zone.. done.

     Tagging interior nodes... done
-----> Running BSP tree to filter out nodes.

-----> done.
Writing data to file.Done writing the nodes to:
    Path: /tmp
    Filename: input4delaunay.a.node

Writing data to file... Done writing surface to a poly file:
    Path: /tmp
    Filename: input4delaunay.poly

---------> Running Delaunay, please wait... done. <---------



--> Finished mesh generation.
Undefined function or variable 'myflag'.

Error in optimize_mesh_gui>optimize_mesh_gui_OpeningFcn (line 78)
if myflag

Error in gui_mainfcn (line 220)
    feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in optimize_mesh_gui (line 40)
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

Error in gui_create_mesh>done_Callback

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in gui_create_mesh (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_create_mesh('done_Callback',hObject,eventdata,guidata(hObject)) 
Error while evaluating UIControl Callback.

 

==================================================

Added line 64 in toolbox/meshing/tools/optimize_mesh_gui.m: 

64 myflag='';
65 if(nargin > 3)

Selected menu in GUI: Mesh->Create Mesh ->Simple Shapes -> Standard

Selected slab and set L/W/H to 20mm and click Done

 

The mesh is generated and the figure dialog for "Place sources and detectors" comes up. 

The mesh is viewable, can be rotated and panned using the tools in the figure window. However, clicking on the mesh generates the following error:

Error using matlab.graphics.axis.Axes/get
There is no x_RenderTransform property on the Axes class.

Error in select3d>local_Data2PixelTransform (line 361)
xform = get(ax,'x_RenderTransform');


Error in select3d (line 208)
xvert = local_Data2PixelTransform(ax,vert)';


Error in gui_place_sources_detectors>figure1_WindowButtonDownFcn (line 386)
    p = select3d;

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in gui_place_sources_detectors (line 42)
    gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)gui_place_sources_detectors('figure1_WindowButtonDownFcn',hObject,eventdata,guidata(hObject)) 
Error while evaluating Figure WindowButtonDownFcn.


==================================================

 

Was not sure how to proceed from there. Let me know if there is any other information needed to help track/fix this. 



Thanks,

--
Karthik Vishwanath, PhD
James C. & Carole E. Garland Professorship

Office: 109 Kreger Hall

Dept. of Physics, Miami University, Oxford OH

Tel: (513) 529-2315

Web: OSIM Lab <http://users.miamioh.edu/vishwak/> 



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/nirfast/attachments/20180509/441ea649/attachment-0001.html>


More information about the Nirfast mailing list