[MINC-users] Usage of mincconcat
Jason Lerch
jason at mouseimaging.ca
Thu Sep 5 09:18:25 EDT 2013
This sounds like a fairly easy roll-your-own task, especially if your tiles are not overlapping and you don't have to figure out how they stitch together.
Some pseudo python code:
from pyminc.volumes.factory import *
from optparse import OptionParser, OptionGroup
if __name__ == "__main__":
# argument parsing bits as needed, but I'm feeling lazy
(options, args) = parser.parse_args()
# construct volume
# need to know the number of slices
output_filename = args.pop()
n_slices = len(args)
vol = volumeFromDescription(output_filename,
options.dimorder,
sizes=(n_slices,output_size[0],output_size[1]),
starts=(0,0,0),
steps=(options.slice_gap,
options.output_resolution, # specify as options - I'm too lazy to add the opt parse bits above :)
options.output_resolution),
volumeType='ushort')
for i in range(n_slices):
# assuming that it's one slice per tile - modify as necessary
inslice = volumeFromFile(args[i])
vol.data[i,:,:] = inslice.data
vol.writeFile()
vol.closeVolume()
Jason
On 2013-09-05, at 8:50 AM, Andrew Wood <andrew at biospective.com> wrote:
> Hi Andrew,
>
> Thanks for that. What I've actually done is split a large image into tiles
> or cubes for processing. Now that I've got processed hyperslabs, I'm
> stitching them back together. From what you described, I'll have to reshape
> the slabs for concatting into rows, then reshape the rows for concatting
> into slices, then reshape the slices for concatting back to the full volume.
>
> I suppose there's no way to stitch them without taking a big reshaping I/O
> hit?
>
> Thanks,
> Andrew
>
>
> On Wed, Sep 4, 2013 at 11:02 PM, Andrew Janke <a.janke at gmail.com> wrote:
>
>> Hi Andrew,
>>
>>> I'm trying to use mincconcat to stitch some images together.
>>>
>>> For example, I have A.mnc:
>>>
>>> dimension name length step start
>>> -------------- ------ ---- -----
>>> yspace 1 0.1 -5.7
>>> zspace 750 0.00295238 15.5531
>>> xspace 750 -0.00295238 33.3619
>>>
>>> and B.mnc:
>>> dimension name length step start
>>> -------------- ------ ---- -----
>>> yspace 1 0.1 -5.7
>>> zspace 750 0.00295238 15.5531
>>> xspace 750 -0.00295238 31.1476
>>>
>>> I've tried concating them along x with something like this:
>>>
>>> mincconcat -concat_dimension xspace A.mnc B.mnc C.mnc
>>>
>>> This comes back with an error:
>>> "Don't use an image dimension as a loop dimension."
>>>
>>> Is there a way to concat these images to make one image with
>>> xspace:length=1500?
>>
>> Indeed there is. mincconcat in general will only work if you are
>> concat'ing on the slowest varying dimension of a file. Thus before you
>> concat do this:
>>
>> mincreshape -dimorder xspace,yspace,zspace A.mnc A_res.mnc
>> mincreshape -dimorder xspace,yspace,zspace B.mnc B_res.mnc
>>
>> At which point:
>>
>> mincconcat -concat_dimension xspace A_res.mnc B_res.mnc C.mnc
>>
>> Should get you what you are after.
>>
>>
>>
>> a
>> _______________________________________________
>> MINC-users at bic.mni.mcgill.ca
>> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>>
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
More information about the MINC-users
mailing list