# Dynamic Reslice

 Name Dynamic Reslice Software Fiji_Plugins Author Jean-Yves Tinevez & Albert Cardona from an ImageJ class Maintainer Jean-Yves Tinevez () Source on GitHub Status active

## Purpose

This plugin is simply a dynamic version of the Reslice command as it is in ImageJ version 1.42l, by Patrick Kelly, Harvey Karten, Rasband , Julian Cooper and Adrian Deerr. It draws an orthogonal slice through the volume represented by the stack it is applied on along its ROI, and update dynamically this slice as the ROI is displaced or deformed.

## Installation

### Fiji

The plugin is part of the Fiji distribution, as a member of the Fiji_Plugins package. You can find it in the Image › Stacks menu.

## Usage

Open a stack and draw a line roi on it (any line roi will do it: straight line, poly-line, freehand line). When you call the plugin you are asked for two parameters.

• Flip vertically will cause the source slices to be processed from bottom to top.
• Rotate 90º will cause the result display to be rotated by 90º.

The reslice window is drawn. Now change the roi shape or move it with the mouse. The result window refreshes automatically. Is is possible to change roi type on the fly.

## Scripting

It is possible to call and control this plugin from other plugin or scripts. Here is a script example for use with Fiji.

'''
This jython script intends at demonstrating how to script the
Dynamic_Reslice plugin. It will open the t1-head sample stack
in Fiji, draw a ROI on it, and animate it while updating the
Reslice image.

Created on Apr 23, 2009

@author: Jean-Yves Tinevez
'''

import fiji
import time

xstart = 40
ystart = 50

# Fetch the t1-head stack from URL
source_imp.show()

# Select middle slice (does not matter)
source_imp.setSlice(60)

# Instantiate the Dynamic_Reslice plugin
dr = fiji.stacks.Dynamic_Reslice(source_imp)

# Set up the plugin so that it will rotate the resulting image, and will
# parse slices from bottom to top
dr.setRotate(True)
dr.setFlip(True)

# Get the destination ImagePlus
dest_imp = dr.getImagePlus()

# Now move the roi and update the image
for dx in range(170):

IJ.showStatus('Moving the Roi by '+str(dx))

# Draw a line ROI on the source imp
roi = Line(xstart+dx, ystart, xstart+dx, ystart+170)
source_imp.setRoi(roi)

# Update the reslice. We have to call it manually in the script.
dr.update();

# Wait a bit so that we can see what is happening
time.sleep(0.03)

IJ.showStatus('Done')


## Version history

• 1.0 - 22 April 2009 - First working version.
• 1.1 - 22 April 2009 - Albert Cardona added the separate thread for updating
• 1.2 - 23 April 2009 -
• Window size automatically changes when Roi length changes
• Can now be called and managed from scripts
• Major refactoring