Well, there is a slightly awkward solution that might do the trick. The idea would be to create a single-voxel image using the
*.mih format (the one with the standalone text-only header so you can edit it yourself), then use mrtransform to regrid that to your target space.
So the header would look like this:
dim: 1,1,1 # single voxel
vox: 10,20,30 # whatever the actual size of the ROI is, in mm.
transform: 0.999171, 0.0407114, 0.000431757, 0.2342
transform: -0.0407124, 0.999167, 0.00267015, 1.2342
transform: -0.000322792, -0.00268555, 0.999996, -9.577
And what you need to worry about is the
vox entry (that’ll set the size of the ROI), and the
transform, which sets the direction vectors (first 3 columns) and position of the centre of the ROI (4th column). Note the direction vectors need to be unit normalised and orthogonal.
You can generate the data file with a command like this (make sure the name matches what’s in the header, under the
$ printf '\001' > ROI.dat
That should already give you an image that you can display in MRView using the ROI editor, e.g.:
$ mrview yourimage.mif -roi.load ROI.mih
At this point, you can simply regrid onto your target space:
$ mrtransform ROI.mih -template yourimage.mif ROI_regrid.mif
Not sure that’ll meet your needs, but to be honest I don’t think we could make it all that much simpler - the hard part is getting the transform right, and specifying it is always going to be somewhat awkward…