MINCRESHAPE(1)

πŸŽ€ MINCRESHAPE(1) πŸŽ€

straight out of the MINC User's Guide, bestie πŸ’–


✨ NAME ✨

mincreshape β€” cuts a hyperslab out of a minc file (with dimension re-ordering) πŸ¦‹


🌸 SYNOPSIS 🌸

mincreshape [<options>] <infile>.mnc <outfile>.mnc

πŸ’… DESCRIPTION πŸ’…

Okay so mincreshape's whole main character job is to chop a hyperslab out of a minc file and drop it into a brand new minc file. And you're probably like "bestie what is a hyperslab" β€” it's literally just a multi-dimensional box, no cap. You describe it with a starting index (a vector that gives you a voxel coordinate) and a count vector (how many voxels along each axis). That's it. That's the whole vibe.

A single slice out of a volume? Hyperslab (count of 1 in the slice direction). A lil block pulled out of a big volume? Hyperslab. A single echo volume out of a multi-echo MRI dataset? Hyperslab. One time point out of a dynamic acquisition? You already know β€” hyperslab. 🌈 Check out the -start, -count and -dimrange options for the deets on how to actually do this (and go look at the examples!!).

Now here's the iconic part: if you're pulling out only one point along a dimension, you have the option of making that dimension disappear, so mincreshape can genuinely reduce the dimensionality of a minc file. Obsessed. And you're not even locked into a hyperslab that lives inside the input file β€” you can extend beyond the bounds of the dimensions in the input file, and you can even hand it a count that will flip the data along a dimension. πŸ”₯

As if that wasn't enough already, mincreshape can re-order dimensions. The most obvious glow-up is converting a transverse image into a coronal image, but you can also just type a list of dimension names and get an arbitrary order. Periodt.

You want MORE?!? Okay okay, calm down, I got you. πŸ™ˆ Mincreshape makes all of the minc library ICV operations available on the command line. For the girlies who like things defined: an ICV is an image conversion variable (don't ask why it's called that, nobody knows) and basically it lets you tell the data what it's gonna look like. In other words, it does a bunch of conversions for you. These conversions include:

  • changing type, range and normalization of the voxel values
  • expanding or contracting images (by voxel duplication or averaging) to give a specified image size
  • converting vector images to scalar

And just so you don't get confused, let me say it super clearly right here: mincreshape does all of the ICV conversions FIRST, and then the hyperslab and dimension re-ordering stuff gets applied to the result of that. So if you wanna mix them together (like -imgsize, -start, -count), get it clear in your head first, bestie. 🧠✨

Okay, hold on to your seat β€” here's a list of options. 🎒


✨ OPTIONS ✨

Quick note before we dive in: options can be specified in abbreviated form (as long as they're unique) and can be given anywhere on the command line. Slay. πŸ’…

🌟 General options 🌟

  • -2 β€” Create MINC 2.0 format output files. ✨
  • -clobber β€” Overwrite an existing file. No thoughts, just vibes.
  • -noclobber β€” Don't overwrite an existing file (default).
  • -verbose β€” Print out progress information for each chunk of data copied (default). A chunk varies in size depending mostly on whether you're re-ordering dimensions or not, and on how big the internal buffer is allowed to be.
  • -quiet β€” Do not print out progress information. 🀫
  • -max_chunk_size_in_kb size β€” Specify the maximum size of the copy buffer (in kbytes). Default is 4096 kbytes (4meg).

πŸŽ€ Image conversion options (pixel type and range) πŸŽ€

The default for type, sign and valid range is to use those of the input file. If type is specified, then both sign and valid range are set to the default for that type. If sign is specified, then valid range is set to the default for the type and sign. (Yes it's a whole cascade situation, we love a chain reaction πŸ’–)

  • -filetype β€” Don't do any type conversion (default).
  • -byte β€” Store output voxels in 8-bit integer format.
  • -short β€” Store output voxels in 16-bit integer format.
  • -int β€” Store output voxels in 32-bit integer format.
  • -long β€” Superseded by -int.
  • -float β€” Store output voxels in 32-bit floating point format.
  • -double β€” Store output voxels in 64-bit floating point format.
  • -signed β€” Write out values as signed integers (default for short and long). Ignored for floating point types.
  • -unsigned β€” Write out values as unsigned integers (default for byte). Ignored for floating point types.
  • -valid_range min max β€” specifies the valid range of output voxel values in their integer representation. Default is the full range for the type and sign. This option is ignored for floating point values.
  • -image_range min max β€” Normalize images to a given minimum and maximum real value (not voxel value).
  • -normalize β€” Normalize images to real minimum and maximum for the entire input file.
  • -nonormalize β€” Do not normalize images (default).
  • -nopixfill β€” Do not convert out-of-range values in input file, just copy them through.
  • -pixfill β€” Replace out-of-range values in input file by the smallest possible value (default).
  • -pixfillvalue value β€” Specify a new pixel value to replace out-of-range values in the input file.

πŸ¦‹ Image conversion options (dimension direction and size) πŸ¦‹

  • -scalar β€” Convert vector images to scalar images (a vector image is one with vector_dimension as the fastest varying dimension). The vector dimension is removed and values are averaged.
  • -noscalar β€” Do not convert vector images to scalar images (default).
  • +direction β€” Flip images to give positive step value for spatial axes. πŸ‘‘ Heads up: the flipping of spatial axes only applies to "image dimensions". These are the two fastest varying (non-vector) dimensions in the file. If you want to flip a non-image dimension, you can convert it to an image dimension with -dimsize dimname=-1 (the -1 means don't really change the size). Check out the examples!
  • -direction β€” Flip images to give negative step value for spatial axes.
  • -anydirection β€” Don't flip images along spatial axes (default).
  • +xdirection β€” Flip images to give positive xspace:step value (left-to-right).
  • -xdirection β€” Flip images to give negative xspace:step value (right-to-left).
  • -xanydirection β€” Don't flip images along x-axis.
  • +ydirection β€” Flip images to give positive yspace:step value (posterior-to-anterior).
  • -ydirection β€” Flip images to give negative yspace:step value (anterior-to-posterior).
  • -yanydirection β€” Don't flip images along y-axis.
  • +zdirection β€” Flip images to give positive zspace:step value (inferior-to-superior).
  • -zdirection β€” Flip images to give negative zspace:step value (superior-to-inferior).
  • -zanydirection β€” Don't flip images along z-axis.
  • -keepaspect β€” Preserve aspect ratio when resizing images. This means that voxels are replicated (or averaged) the same number of times along each image dimension. πŸ’–
  • -nokeepaspect β€” Do not force preservation of aspect ratio when resizing images (default).
  • -imgsize size β€” Specify the desired image size (used if -rowsize or -colsize not given).
  • -rowsize size β€” Specify the desired number of rows in the image.
  • -colsize size β€” Specify the desired number of columns in the image.
  • -dimsize dimension=size β€” Specify the size of a named dimension (dimension=size). Note that the resizing only applies to "image dimensions" β€” usually the two fastest-varying (non-vector) dimensions. To do dimension resizing, all fastest-varying dimensions up to the named dimension are turned into image dimensions, and these are then affected by the direction options. The dimension name and size must be in one command-line argument, so if you use spaces (which is okay), remember to use quotes to hide them from the shell. πŸ™ˆ

🌈 Reshaping options 🌈

  • -transverse β€” Write out transverse slices.
  • -sagittal β€” Write out sagittal slices.
  • -coronal β€” Write out coronal slices.
  • -dimorder dim1,dim2,dim3,... β€” Specify dimension order, where dim? are the names of the dimensions. You can give fewer dimensions than exist in the file: they are assumed to be the fastest varying dimensions in the output file (so -transverse is exactly equivalent to -dimorder zspace,yspace,xspace). Again, spaces are allowed between names, but remember to hide them from the shell with quotes.
  • -dimrange dim=start[,count] β€” Specify the range of dimension subscripts for dimension dim. If count is missing or 0, then it is taken to mean 1, but remove the dimension from the output file (a count of 1 will keep a dimension of size 1). A negative count means flip the data along that dimension β€” in this case start specifies the highest voxel coordinate for the dimension (-dimrange xspace=3,-3 gives a flipped version of -dimrange xspace=1,3). The options -start and -count provide an alternative way to specify the same information.
  • -start coord0,coord1,coord2,... β€” Specifies the starting corner of the hyperslab (coordinates go from slowest varying dimension to fastest). If fewer coordinates are given than dimensions exist in the file, then they are assumed to apply to the slowest varying dimensions and the remaining coordinates are set to 0. See -dimrange for more details. Both -start and -count give vectors that correspond to input file dimensions after the image conversion (ICV) options have been applied.
  • -count size0,size1,size2,... β€” Specifies edge lengths of hyperslab to read (coordinates go from slowest varying dimension to fastest). If fewer sizes are given than dimensions exist in the file, then they are assumed to apply to the slowest varying dimensions and the remaining sizes are set to the full size of the dimension. See -dimrange for more details. Both -start and -count give vectors that correspond to input file dimensions after the image conversion (ICV) options have been applied.

πŸ’œ Missing data options πŸ’œ

  • -nofill β€” Use value zero for points outside of the input volume (default).
  • -fill β€” Use a fill value for points outside of input volume (minimum possible value).
  • -fillvalue value β€” Specify a fill value for points outside of the input volume (this is a real value, not a pixel value).

okay bestie that's part 1 πŸ’– more coming, don't go anywhere ✨

🌈 Generic options for all commands 🌈

Like, every single command in this whole fam has these two. They're the little universal safety blankets πŸ’–

  • -help β€” prints a summary of the command-line options and then dips out (exits). Your "wait what does this do again" button 🫢
  • -version β€” prints the program's version number and exits. That's it, that's the whole job ✨

✨ EXAMPLES ✨

Okay bestie, story time. Let's say we've got a volume with dimensions zspace, yspace, xspace (that's transverse, keep up πŸ‘‘) and the sizes are 128, 256, 256.

We want slice 40 out of it β€” and we wanna keep the coordinate info for the zspace dimension. So:

mincreshape original.mnc new.mnc -dimrange zspace=40,1

Slay. πŸ’…

Or, alternatively, you could do the exact same thing the long way:

mincreshape original.mnc new.mnc -start 40,0,0 -count 1,256,256

Or, honestly, just keep it cute and short:

mincreshape original.mnc new.mnc -start 40 -count 1

Now what if we wanted to fully get rid of the zspace dimension? Not me ghosting an entire axis 😭

mincreshape original.mnc new.mnc -dimrange zspace=40,0

Let's grab a block out of the middle and flip it along xspace. Main character energy:

mincreshape original.mnc new.mnc \
   -start 40,10,240 -count 1,200,-200

But like… why restrain ourselves?? πŸ€ͺ Let's go fully out of bounds:

mincreshape original.mnc new.mnc \
   -start 40,-100,340 -count 1,200,-200

You want a sagittal volume? Say less:

mincreshape original.mnc new.mnc -sagittal

How about some sideways heads β€” flip x and y β€” and convert to byte to save space while we're at it? Two birds, one reshape πŸ¦‹

mincreshape original.mnc new.mnc -dimorder xspace,yspace -byte

Oh, you like storing volumes in x,y,z order? That's z varying fastest! I know people who do it, no judgement πŸ’€ Okay:

mincreshape original.mnc new.mnc -dimorder xspace,yspace,zspace

But you're a minimalist (and don't mind taking a chance πŸ™ˆ). Here's the same thing β€” except it might break for another file:

mincreshape original.mnc new.mnc -dimorder zspace
Lowkey risky. That's the vibe. You've been warned.

Finally, let's make sure all dimensions have a negative step attribute (peep the +direction option for the deets):

mincreshape original.mnc new.mnc -direction -dimsize zspace=-1

πŸ‘‘ AUTHOR

Peter Neelin

πŸ“œ COPYRIGHTS

Copyright Β© 1994 by Peter Neelin

πŸ”— SEE ALSO


And that's the whole page, bestie πŸ’– this was $Date: 2004-05-20 21:52:09 $ energy, brought to you by MINCRESHAPE(1) β€” go reshape something iconic, periodt ✨

πŸ“¦ where this page comes from