add a recipe module to modify the origin when needed#1483
Conversation
|
A number of thoughts / considerations here:
class SetOriginMetadata(ModuleBase):
inputImage = Input('input')
outputImage = Output('output')
def run(self, inputImage):
# create a new image, using the data from the old image
# this re-uses the reference to the unmodified image data so we don't need to allocate more memory
# but creates a new, empty, metadata
im = ImageStack(inputImage.data, titleStub=self.outputImage)
# copy the metadata entries from the original image
im.mdh.copyEntriesFrom(inputImage.mdh)
# add any module-specific metadata to the output image
self.completeMetadata(im)
# return the new image
return im
def completeMetadata(self, im):
'''Do any required modifications to the output metadata"
# Set origin etc ... |
|
Actually, on second thoughts, don't implement class SetOriginMetadata(ModuleBase):
inputImage = Input('input')
outputImage = Output('output')
def run(self, inputImage):
# create a new image, using the data from the old image
# this re-uses the reference to the unmodified image data so we don't need to allocate more memory
# but creates a new, empty, metadata
im = ImageStack(inputImage.data, titleStub=self.outputImage)
# copy the metadata entries from the original image (note, this is not technically required, as the .execute()
# method will automatically copy (merge) the input metadata to the output, but it doesn't hurt to be explicit)
im.mdh.copyEntriesFrom(inputImage.mdh)
# add any module-specific metadata to the output image
im.mdh['Origin.x'] = #New origin value
....
# return the new image.
return imThe rationale here is the |
|
Also note that |
|
Thanks, David! I am also not sure either if this is a long-term solution, but making the origin changable does make it easier to overlay two imaging modalities on different cameras, although the origin is actually an 'effective origin' based on users and instrument instead of 'real metadata origin'. Previously I used |
Is this a bugfix or an enhancement?
Enchancement
Proposed changes:
With this module we could modify the xy origin in PYMEImage. This could serve as the initial coarse offset before calculating the shiftmap of two cameras/modalities. I did not try do to it in PYMEAcquire because practically there would be some drift and the shiftmap should be calibrated regularly (once every 2 to 3 weeks). Every time the initial offset is a little bit different.
Checklist:
The below is a list of things what will be considered when reviewing PRs. It is not prescriptive, and does not
imply that PRs which touch any of these will be rejected but gives a rough indication of where there is a potential
for hangups (i.e. factors which could turn a 5 min review into a half hour or longer and shunt it to the bottom
of the TODO list).
much simpler if this is kept separate from functional changes. The auto-formatting performed by some editors is particulaly egregious and can lead to files with thousands
of non-functional changes with a few functional changes scattered amoungst them]
If an enhancement (or non-trivial bugfix):