PreibischLab / multiview-reconstruction

Software for the reconstruction of multi-view microscopic acquisitions like Selective Plane Illumination Microscopy (SPIM) Data
GNU General Public License v2.0
22 stars 22 forks source link

How to fuse in Fiji Macro using the "default" bounding box #12

Open Xqua opened 5 years ago

Xqua commented 5 years ago

Hi, I'm curious on how I can make a run() statement for the fusion that will take the default bounding box that is "offered" in the BDV selection.

Basically I have a lot (90+) dataset of fixed embryos and I'm trying to automate the process instead of clicking through it 90+ times.

I know how to do it for timelapses, but not for different dataset.

So far I'm here (aka I can run the define CZI detection and registration) But I can't seem to find a parameter set for fusion that will let me run it without a popup OR a pre defined bounding box.

Thanks !

// "BatchProcessFolders"
//

   dir = getDirectory("Choose a Directory ");
   setBatchMode(true);
   count = 0;
   countFiles(dir);
   n = 0;
   processFiles(dir);
   //print(count+" files processed");

   function countFiles(dir) {
      list = getFileList(dir);
      for (i=0; i<list.length; i++) {
          if (endsWith(list[i], "/"))
              countFiles(""+dir+list[i]);
          else
              count++;
      }
  }

   function processFiles(dir) {
      list = getFileList(dir);
      for (i=0; i<list.length; i++) {
          if (endsWith(list[i], "/"))
              processFiles(""+dir+list[i]);
          else {
             showProgress(n++, count);
             path = dir+list[i];
             processFile(path);
          }
      }
  }

  function processFile(path) {
       if (endsWith(path, ".czi")) {
           name = File.getName(path);
           name = substring(name, 0, lastIndexOf(name, “.”));
           params = "type_of_dataset=[Zeiss Lightsheet Z.1 Dataset (LOCI Bioformats)] xml_filename=";
           params += name;
           params += ".xml browse=";
           params += path;
           params += " first_czi=";
           params += path;
           params += " angle_1=0 angle_2=90 angle_3=180 angle_4=270 channel_1=405 channel_2=561 channel_3=488 channel_4=638 _______illumination_1=0 apply_rotation_to_dataset fix_bioformats";
           run("Define Multi-View Dataset", params);

           xml_path = substring(path, 0, lastIndexOf(path, “/”)) + "dataset.xml";
           params = "select_xml=" + xml_path + " process_angle=[All angles] process_channel=[Single channel (Select from List)] process_illumination=[All illuminations] process_timepoint=[All Timepoints] processing_channel=[channel 488] type_of_interest_point_detection=Difference-of-Gaussian label_interest_points=beads downsample_images subpixel_localization=[3-dimensional quadratic fit] interest_point_specification=[Weak & small (beads)] downsample_xy=[Match Z Resolution (less downsampling)] downsample_z=2x compute_on=[CPU (Java)]";
           run("Detect Interest Points for Registration", params);

           params = "select_xml=" + xml_path +  process_angle=[All angles] process_illumination=[All illuminations] process_timepoint=[All Timepoints] registration_algorithm=[Fast 3d geometric hashing (rotation invariant)] type_of_registration=[Register timepoints individually] interest_points_channel_405=[(DO NOT register this channel)] interest_points_channel_561=[(DO NOT register this channel)] interest_points_channel_488=beads interest_points_channel_638=[(DO NOT register this channel)] fix_tiles=[Fix first tile] map_back_tiles=[Do not map back (use this if tiles are fixed)] transformation=Affine regularize_model model_to_regularize_with=Rigid lamba=0.10 allowed_error_for_ransac=5 significance=10";
           run("Register Dataset based on Interest Points", params);

      }
  }
StephanPreibisch commented 5 years ago

Hi, I can record it with the macro recorder like that:

run("Fuse dataset ...", "select=/Users/spreibi/Documents/Microscopy/SPIM/HisYFP-SPIM/dataset.xml process_angle=[All angles] process_channel=[All channels] process_illumination=[All illuminations] process_tile=[All tiles] process_timepoint=[All Timepoints] bounding_box=[All Views] downsampling=13 pixel_type=[32-bit floating point] interpolation=[Linear Interpolation] image=[Precompute Image] blend produce=[Each timepoint & channel] fused_image=[Display using ImageJ]");

StephanPreibisch commented 5 years ago

the important part is: "bounding_box=[All Views]"

Xqua commented 5 years ago

That is great ! I could not find this somehow ... Thanks a lot !On Aug 2, 2018 2:36 PM, Stephan Preibisch notifications@github.com wrote:the important part is: "bounding_box=[All Views]"

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread.

Xqua commented 5 years ago

Hi @StephanPreibisch

I'm getting an "All views" is not a valid option error

What Macro language are you using ? (If I record my macros I also do not get a "Fuse dataset ..." I get a "Fuse/Deconvolve Dataset")