Create Hyperstack - Composite Problem

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

Create Hyperstack - Composite Problem

Greg
Hi,

I want to partially open a huge Hyperstack which consists of many frames and 3 color channels.

I do the following:

width = 1004
height = 1002
NFrames = 2
HS = IJ.createHyperStack('PartialStack',width,height,3,1,NFrames,16)
stack = HS.getStack()


orig = IJ.openImage(path+name)
o_stack = orig.getStack()
orig.show()

print o_stack.getSize()
print stack.getSize()
print orig.getDimensions()

for sliceIndex in range(1,2*NFrames +1):
    c = sliceIndex%3
    if c == 0:
        c = 3
    print 'slice ',sliceIndex,c

    ip = o_stack.getProcessor(sliceIndex)
    imp = ImagePlus('channel' + str(c),ip)
    stack.setProcessor(ip,sliceIndex)
    print HS.getCompositeMode()
    print HS.isComposite()

As a results, I get correctly a Hyperstack with the correct dimensions. The Problem is, that the Channels are somehow merged LUT-wise. So when I measure the distinct channels, I think the results are correct, but I see merged Channels (1-3). So we loose the visual information which is bad. I think somehow the LUTs get merged, but I do not know how to control/fix this.

Greets,
Greg
Reply | Threaded
Open this post in threaded view
|

Re: Create Hyperstack - Composite Problem

Greg
Ok,

so it is not just a LUT merge, the channels get really "stacked together", maybe even by direct addition ?
So I think this stack.setProcessor(ip,sliceIndex) does not work as I expect on Hyperstacks ?

Greg
Reply | Threaded
Open this post in threaded view
|

Re: Create Hyperstack - Composite Problem

Greg
So in the end I solved the Problem by calling the "Stack to Hyperstack" Plugin directly:

# new empty Stack                                                                                    
Stack = ImageStack(width,height)

for sliceIndex in range(start,3*NFrames +1):
    IJ.showProgress(sliceIndex,3*NFrames)
    c = sliceIndex%3
    if c == 0:
        c = 3
    print 'slice ',sliceIndex,c
    ip = bf.getProcessor(sliceIndex)
    Stack.addSlice(None,ip)
    # stack.setProcessor(ip,sliceIndex)                                                              

name = 'Frames ' + str(start) + '-' + str(end) + ' ' + filename
imp = ImagePlus(name,Stack)

IJ.run(imp,"Stack to Hyperstack...", "order=xyczt(default) channels=3 slices=1 frames="+str(NFrames)\
+" display=Color");