nolanlab / RAPID

RAPID: a Real-time, GPU-Accelerated Parallelized Image processing software for large-scale multiplexed fluorescence microscopy Data
GNU General Public License v3.0
10 stars 0 forks source link

Error trying to run RAPID #1

Open khoichu2 opened 1 year ago

khoichu2 commented 1 year ago

I am not sure what is wrong.. Below are the logs:

Start deconvolution... Warning: File: deconv_par.m Line: 40 Column: 13 The temporary variable 'im_folder_name' will be cleared at the beginning of each iteration of the parfor-loop. If 'im_folder_name' is used before it is set, a runtime error will occur. For more information, see Parallel for Loops in MATLAB, "Uninitialized Temporaries".

In RAPID_0097_ver2 (line 82) Warning: File: deconv_par.m Line: 41 Column: 13 The temporary variable 'im_folder_name_alt' will be cleared at the beginning of each iteration of the parfor-loop. If 'im_folder_name_alt' is used before it is set, a runtime error will occur. For more information, see Parallel for Loops in MATLAB, "Uninitialized Temporaries". In RAPID_0097_ver2 (line 82) Warning: File: deconv_par.m Line: 57 Column: 13 The temporary variable 'im_file_bcf' will be cleared at the beginning of each iteration of the parfor-loop. If 'im_file_bcf' is used before it is set, a runtime error will occur. For more information, see Parallel for Loops in MATLAB, "Uninitialized Temporaries". In RAPID_0097_ver2 (line 82) Warning: File: deconv_par.m Line: 58 Column: 13 The temporary variable 'im_file_bcf_alt' will be cleared at the beginning of each iteration of the parfor-loop. If 'im_file_bcf_alt' is used before it is set, a runtime error will occur. For more information, see Parallel for Loops in MATLAB, "Uninitialized Temporaries". In RAPID_0097_ver2 (line 82) Deconvolution: reg4... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... bcf file does not exist, skipping... Deconvolution done... Start stitching... Generating positions...

MIJ 1.3.9: Matlab to ImageJ Interface

More Info: http://bigwww.epfl.ch/sage/soft/mij/ Help: MIJ.help JVM> 1.3.9 JVM> Version: 1.8.0_202 JVM> Total amount of memory: 1293312 Kb JVM> Amount of free memory: 276734 Kb ImageJ> Version:1.53i ImageJ> Memory:1039MB of 26427MB (3%) ImageJ> Directory plugins: C:\Users\kchu\Fiji.app\plugins\ ImageJ> Directory macros: C:\Users\kchu\Fiji.app\macros\ ImageJ> Directory luts: C:\Users\kchu\Fiji.app\luts\ ImageJ> Directory image: Not specified ImageJ> Directory imagej: C:\Users\kchu\Fiji.app\ ImageJ> Directory startup: C:\Users\kchu\Fiji.app\ ImageJ> Directory home: C:\Users\kchu\

Status> ImageJ is running.

generating stitching positions: reg4... generating stitching positions: cyc1... generating stitching positions: cyc2... generating stitching positions: cyc3... generating stitching positions: cyc4... generating stitching positions: cyc5... generating stitching positions: cyc6... generating stitching positions: cyc7... generating stitching positions: cyc8... generating stitching positions: cyc9... generating stitching positions: cyc10... generating stitching positions: cyc11... generating stitching positions: cyc12... generating stitching positions: cyc13... generating stitching positions: cyc14... generating stitching positions: cyc15... generating stitching positions: cyc16... generating stitching positions: cyc17... generating stitching positions: cyc18... generating stitching positions: cyc19... generating stitching positions: cyc20... ImageJ instance ended cleanly Making mosaics... Region 4 mosaics Cycle 1 mosaic Error using feof Invalid file identifier. Use fopen to generate a valid file identifier.

Error in load_csv_file_into_cell_array (line 31) while ~feof(fh)

Error in makeMosaic (line 21) cell_array = load_csv_file_into_cell_array(global_pos_path);

Error in RAPID_0097_ver2 (line 96) makeMosaic(path_output,reg_range,cyc_range);

smith6jt-cop commented 1 year ago

Did you ever figure out the problem?

khoichu2 commented 1 year ago

Sorry, no

On Mon, Nov 20, 2023, 3:36 PM Justin Smith @.***> wrote:

Did you ever figure out the problem?

— Reply to this email directly, view it on GitHub https://github.com/nolanlab/RAPID/issues/1#issuecomment-1819839942, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3MPVXWVIKXKNFHP4QX5TYTYFPEMTAVCNFSM6AAAAAAT3A77QOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJZHAZTSOJUGI . You are receiving this because you authored the thread.Message ID: @.***>

LPasic commented 12 months ago

Hi everyone,

I have run into the same error when trying to run RAPID for our lab’s CODEX images, and I’ve been trying to troubleshoot the script for the past 2 months.

This particular error occurs because “makeMosaic.m” looks for a file called “reg(#)_cycle(#)_global-positions-0.txt” within the output folder but can’t find it. This global positions text file was supposed to be generated by the MIST stitching plugin within Fiji/ImageJ. From what I can tell, the file should be generated in “MIST_Stitch.m” on the line: MIJ.run( ‘MIST’, ['gridwidth=',num2str(grid_size_x),’ …etc… debuglevel=NONE’]) On my end, this line simply does not actually run the MIST plugin (even though ImageJ is opened), so no global positions file is generated.

I have side-stepped this issue by running the MIST stitching plugin manually for each cycle. In my case, I have a 6 x 9 grid, so the Deconvolution script in Module 1 generated 54 tiles within each of my “/1_deconv_stitch/cycle(#)/” directories. Once I opened Fiji, I selected Plugins>Stitching>MIST and entered the following parameters:

Tab 1: Input Filename Pattern Type: Sequential Starting Point: Upper Left Direction: Horizontal Continuous Grid Width: 6 (change this to fit your parameters) Grid Height: 9 (change this to fit your parameters) Grid Start Tile: 1 Timeslices: 0 Filename pattern: reg1tile{p} (change this according to the region number, e.g. reg4tile{p} in your case) Image Directory: D:\MATLAB processing\02-processed\Panel6-test\reg1\1_deconv_stitch\cycle1 (change to your “1_deconv_stitch\cycle(#)” folder) "Assemble from metadata" is UNchecked

Tab 2: Output Output Directory is the same as Input Directory above. Filename prefix: reg1cycle1 (change, depending on which region and cycle is being processed) Blending mode: Linear; Alpha: 1.5 Compression mode: UNCOMPRESSED Leave "Display Stitched Image" and "Save Full Stitched Image" UNchecked

Pixel Size Metadata: enter as needed. Mine is in nanometers, 377.0 (x) by 377.0 (y)

Tab 3: Subgrid CHECK "Use full grid"

Tab 4: Advanced Stage repeatability: leave blank Horizontal overlap: 30.0 (for our Keyence setup) Vertical overlap: 30.0 (for our Keyence setup) Overlap uncertainty: 5.0

Other Advanced Parameters: leave all UNchecked Translation Refinement Method: Single Hill Climb (Default to Number 16) Number of FFT Peaks: Blank Log level: Mandatory Debug Level: None Stitching Program: FFTW CPU Worker Threads: 20 FFTW Plan Type: Measure CHECK Save Plan CHECK Load Plan FFTW Library File: D:\MATLAB processing\MATLAB Fiji\lib\fftw\libfftw3.dll (find this .dll within your Fiji "lib\fftw" folder) Plan Location (or file): D:\MATLAB processing\MATLAB Fiji\lib\fftw\fftPlans (find this directory within your Fiji "lib\fftw" folder)

Then click Begin Stitching.

After this process is finished, you will have 5 new .txt files in your "1_deconv_stitch\cycle(#)" directory. One of them will be "reg1_cycle1_global-positions-0.txt" (for region 1, cycle 1). This is the file that's needed by makeMosaic.m.

You will need to repeat the MIST Stitching process for each Cycle. This should be relatively fast at this step since you have set up most of the stitching parameters. All you need to do is to go to the Input Tab, then change the Image Directory to "1_deconv_stitch\cycle2" - and then click the Output tab to make sure the output directory matches. On this tab, also make sure to change the "Filename Prefix" to reflect the new Cycle name. Click Begin Stitching for Cycle 2.

etc.

Once each Cycle folder has a global positions file, you can run Module 2 in RAPID.m.

This time, makeMosaic.m should work as intended. You will end up with a "_montage.tif" file within each Cycle folder after this module is finished. The "_montage.tif" files will be used in the Lateral Drift Compensation portion.

However, I was using the “multipoint” module on our Keyence microscope, so I had to edit the script of driftCompensate_par.m as well because the current multipoint script tries to overlay "tile_1.tif" from Cycles 2-n with the "_montage.tif" image from Cycle 1. If you are using the memopoint module, I think you won’t have this problem. I also had to add the argument “mode” to the function in Line 13 of driftCompensate_par.m in order to get this script to run properly as well. That is, Line 13 now reads as follows: function driftCompensate_par(reg_range,cyc_range,path_input,nCh,nTil,gpu_id,mode)

Make sure to change this in Line 91 of the RAPID.m script as well.

Anyway, this is the only work-around I have found. It's a bit time-intensive depending on the number of regions/cycles you have, but it does work.

I am trying to figure out why MATLAB is having issues running the MIST plugin from Fiji. All other Fiji/ImageJ functions are working fine in the context of Miji (e.g. the genHyperstack.m script runs fine). I’ve tried the following method, after setting up the java paths for Miji. Type “Miji;” or “MIJ.start(pluginpath)” in the command line to get an ImageJ window open within MATLAB. Then, manually click on the Plugins > Stitching > MIST option. At this point, MIST never opens, and I get this “Exception” message instead:

“ImageJ 1.54f; Java 1.8.0_202 [64-bit]; Windows 10 10.0; 316MB of 26358MB (1%)

java.lang.NoSuchFieldError: COMPRESSION_ZLIB at gov.nist.isg.mist.lib.export.CompressionMode.(CompressionMode.java:10) at gov.nist.isg.mist.gui.panels.outputTab.OutputPanel.(OutputPanel.java:85) at gov.nist.isg.mist.StitchingGUIFrame.initContent(StitchingGUIFrame.java:127) at gov.nist.isg.mist.StitchingGUIFrame.init(StitchingGUIFrame.java:118) at gov.nist.isg.mist.StitchingGUIFrame.(StitchingGUIFrame.java:98) at gov.nist.isg.mist.StitchingGUIFrame.(StitchingGUIFrame.java:84) at gov.nist.isg.mist.MISTMain.run(MISTMain.java:266) at ij.IJ.runUserPlugIn(IJ.java:244) at ij.IJ.runPlugIn(IJ.java:210) at ij.Executer.runCommand(Executer.java:152) at ij.Executer.run(Executer.java:70) at java.lang.Thread.run(Thread.java:748)”

It seems that maybe the ZLIB compression option within the MIST plugin, found in the Compression drop-down menu from the Output tab, is causing some kind of error in the initialization of the Plugin. I’m not exactly sure where to go from here. In the meantime, I hope this manual workaround helps some people. It would be nice to have the MIST stitching function automated within MATLAB, as intended, but I have not had luck with it so far. If you know how to fix this issue, please let me know!