Skip to content
Snippets Groups Projects
Select Git revision
  • 37988a6b22de5d049a0bf3a65262b8faadf29a22
  • master default protected
  • cleanup_fixtures
  • add-openvox
  • freebsd-14
  • remove-legacy-top-scope-syntax
  • rel430
  • tests
  • revert-363-augeas-module-cleanup
  • release-4.1.0
  • puppet8
  • relax-dependencies
  • rel400
  • mode
  • puppet7
  • release-3.1.0
  • freebsd13
  • freebsd11
  • stdlib
  • centos
  • fedora
  • v5.1.0
  • v5.0.0
  • v4.5.0
  • v4.4.0
  • v4.3.0
  • v4.2.1
  • v4.2.0
  • v4.1.0
  • v4.0.0
  • v3.1.0
  • v3.0.0
  • v2.0.0
  • 1.12.0
  • 1.11.0
  • 1.10.0
  • 1.9.0
  • 1.8.0
  • 1.7.0
  • 1.6.0
  • 1.5.0
41 results

postfix-mailman.pp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    First_Step_ReadAndReduceHyperstack.ijm 3.54 KiB
    // Nicolas ELIE
    // Université de Caen Normandie
    // Reduce Z HyperStack
    // Allows to remove z-slides at the beginning and at the end of the image stack without touching the organization of the channels
      macro "First_Step_ReadAndReduceHyperstack.ijm" {
        requires("1.50");
    
        // deletes all the images in ImageJ
        run("Close All");
        // delete all ImageJ windows
        Winlist = getList("window.titles");
        if (Winlist.length>0){
            for (i=0; i<Winlist.length; i++){
                selectWindow(Winlist[i]);
                if(Winlist[i]!="First_Step_ReadAndReduceHyperstack.ijm"){
                    run("Close");
                } 
            }
        }
    
    
    
        // open a dialog box to select the directory where the images are located
        path=getDirectory("Choose a Directory");
        //creation of a list table containing all the files present in the current directory
        list = getFileList(path);
    
    /*********************************************************************************
    *           For backup
    *    Creation of an OibReduce folder which contains the images in tif format
    *    after deleting the slides of the original file in oib format
    * *******************************************************************************/
       
        
        // Creation of the OibReduce folder
            // path definition
        myDir = path+"OibReduce"+File.separator;
            // record path
        File.makeDirectory(myDir);
            // Test creation
        if (!File.exists(myDir))
            exit("Unable to create directory");
        
        // Start loop; Browse directory
        for (ii=0; ii<list.length; ii++) {
             IJ.redirectErrorMessages();
            // Open only oib files - Olympus 
            if (endsWith(list[ii], "oib")){            
                /***********************************************************
                //   opening image 
                ********************************************************** */
                val=lastIndexOf(list[ii], ".");
                root=substring(list[ii],0,val)+".tif";            
                if (!File.exists(path+"/OibReduce/"+root)){
                    run("Bio-Formats Macro Extensions");
                    Ext.openImagePlus(path+list[ii]);
                    Ext.close()
    
                if (!Stack.isHyperStack) exit ("HyperStack required");
    
                // Number of Channels
                Stack.getDimensions(width, height, channels, slices, frames) ;
                Dialog.createNonBlocking("Reduce Z HyperStack");
                Dialog.addMessage("Indicate valide range slices");
                Dialog.addNumber("Start", 1)
                Dialog.addNumber("End", nSlices/channels)
                Dialog.show;
    
                // retrieve the numbers indicated
                start=Dialog.getNumber();
                end=Dialog.getNumber();
    
                // Calculate the number of planes expected in the end
                nFinal=((end-start)*channels)+channels;
    
    
                //remove first slides
                for(i=1;i<start;i++){
                    setSlice(1);
                    run("Delete Slice", "delete=slice");
                }
    
                
                //remove last slides
                
                // if there is no or no more deletion to be done, end of the process
                if(nFinal!=nSlices){
                    // as long as the desired number is not reached, delete z-slides
                    do {
                        setSlice(nSlices);
                        run("Delete Slice", "delete=slice");
                    } while (nSlices!=nFinal);
                }
                run("16-bit");
                saveAs("Tiff", path+"/OibReduce/"+root);
                run("Close");                   
    }
    }
    }
    waitForUser("Information", "End of procedure");
    }