Change canvas size for all images in a dicom image set.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Change canvas size for all images in a dicom image set.

John Thaman
Greetings,

I am looking to use imagej to change the canvas size for a large set of DICOM images.The actual goal is to change the images suchthat they have equal numbers of columns and rows without changing the aspect ratio of the data. I can do this manually by changing canvas size and saving each individual image/slice. I am receiving increasingly larger image sets and wishto utilize a plugin or macro that will do this for me. Please advise if you know of an available tool.

Thank You


John Thaman, MS, DABR
MRP, Inc.
859-835-2772

**MRP, Inc. Confidentiality Notice**
This message and the accompanying document or attachments may contain information which is privileged, confidential and/or protected health information.  If you are not the intended recipient, you may not review, discuss, disclose, copy or distribute the contents of this message.  If you have received this information in error, please immediately contact the MRP, Inc. representative whose email is listed on this message and delete all evidence of this correspondence.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Change canvas size for all images in a dicom image set.

Rasband, Wayne (NIH/NIMH) [E]
On Feb 23, 2015, at 10:29 AM, John Thaman <[hidden email]> wrote:
>
> Greetings,
>
> I am looking to use imagej to change the canvas size for a large set of DICOM images.The actual goal is to change the images suchthat they have equal numbers of columns and rows without changing the aspect ratio of the data. I can do this manually by changing canvas size and saving each individual image/slice. I am receiving increasingly larger image sets and wishto utilize a plugin or macro that will do this for me. Please advise if you know of an available tool.

You can do this using the macro below.

-wayne

  w = 1024;
  h = 1024
  dir1 = getDirectory("Choose Source Directory ");
  dir2 = getDirectory("Choose Destination Directory ");
  list = getFileList(dir1);
  setBatchMode(true);
  for (i=0; i<list.length; i++) {
     showProgress(i+1, list.length);
     open(dir1+list[i]);
     run("Canvas Size...", "width=&w height=&h position=Center zero");
     saveAs("tiff", dir2+list[i]);
     close();
  }

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html