def runCellCoordinateTransformationToReference(parameter): """Transform points by resampling and applying the elastix transformation in the reference data""" im = parameter.Resampling.DataFiles; if im is None: im = parameter.DataSource.ImageFile; cf = parameter.ImageProcessing.CellCoordinateFile; pa = parameter.Alignment; pr = parameter.Resampling; # downscale points to referenece image size points = resamplePoints(cf, im, resolutionData = pr.ResolutionData, resolutionReference = pr.ResolutionReference, orientation = pr.Orientation); # transform points #points = points[:,[1,0,2]]; points = transformPoints(points, alignmentdirectory = pa.AlignmentDirectory, transformparameterfile = None, read = True, tmpfile = None, outdirectory = None, indices = True); #points = points[:,[1,0,2]]; tf = parameter.ImageProcessing.CellTransformedCoordinateFile; if tf is None: return points; else: io.writePoints(tf, points); return tf;
def runCellCoordinateTransformation(parameter): """Transform points by resampling applying the elastix transformation and then re-resample again""" im = parameter.Resampling.DataFiles; if im is None: im = parameter.DataSource.ImageFile; cf = parameter.ImageProcessing.CellCoordinateFile; pa = parameter.Alignment; pr = parameter.Resampling; # downscale points to referenece image size points = resamplePoints(cf, im, resolutionData = pr.ResolutionData, resolutionReference = pr.ResolutionReference, orientation = pr.Orientation); # transform points points = points[:,[1,0,2]]; # account for (y,x, z) array representaton here points = transformPoints(points, alignmentdirectory = pa.AlignmentDirectory, transformparameterfile = None, read = True, tmpfile = None, outdirectory = None, indices = False); points = points[:,[1,0,2]]; # account for (y,x, z) array representaton here # upscale ppints back to original size points = resamplePointsInverse(points, im, resolutionData = pr.ResolutionData, resolutionReference = pr.ResolutionReference, orientation = pr.Orientation); tf = parameter.ImageProcessing.CellTransformedCoordinateFile; if tf is None: return points; else: io.writePoints(tf, points); return tf;
def runCellCoordinateTransformationToReference(parameter): """Transform points by resampling and applying the elastix transformation in the reference data""" im = parameter.Resampling.DataFiles if im is None: im = parameter.DataSource.ImageFile cf = parameter.ImageProcessing.CellCoordinateFile pa = parameter.Alignment pr = parameter.Resampling # downscale points to referenece image size points = resamplePoints(cf, im, resolutionData=pr.ResolutionData, resolutionReference=pr.ResolutionReference, orientation=pr.Orientation) # transform points #points = points[:,[1,0,2]]; points = transformPoints(points, alignmentdirectory=pa.AlignmentDirectory, transformparameterfile=None, read=True, tmpfile=None, outdirectory=None, indices=True) #points = points[:,[1,0,2]]; tf = parameter.ImageProcessing.CellTransformedCoordinateFile if tf is None: return points else: io.writePoints(tf, points) return tf
def runCellCoordinateTransformation(parameter): """Transform points by resampling applying the elastix transformation and then re-resample again""" im = parameter.Resampling.DataFiles if im is None: im = parameter.DataSource.ImageFile cf = parameter.ImageProcessing.CellCoordinateFile pa = parameter.Alignment pr = parameter.Resampling # downscale points to referenece image size points = resamplePoints(cf, im, resolutionData=pr.ResolutionData, resolutionReference=pr.ResolutionReference, orientation=pr.Orientation) # transform points points = points[:, [1, 0, 2]] # account for (y,x, z) array representaton here points = transformPoints(points, alignmentdirectory=pa.AlignmentDirectory, transformparameterfile=None, read=True, tmpfile=None, outdirectory=None, indices=False) points = points[:, [1, 0, 2]] # account for (y,x, z) array representaton here # upscale ppints back to original size points = resamplePointsInverse(points, im, resolutionData=pr.ResolutionData, resolutionReference=pr.ResolutionReference, orientation=pr.Orientation) tf = parameter.ImageProcessing.CellTransformedCoordinateFile if tf is None: return points else: io.writePoints(tf, points) return tf
#Resolution of the Reference / Atlas (in um/ pixel) as (x,y,z) "resolutionSink" : (12, 15, 5), #Orientation of the Data set wrt reference as (x=1,y=2,z=3) #(-axis will invert the orientation, for other hemisphere use (-1, 2, 3), to exchnge x,y use (2,1,3) etc) "orientation" : (1,2,3) }; alignmentDirectory = os.path.join(baseDirectory, 'Synthetic/elastix'); # downscale points to referenece image size points = resamplePoints(pointsFile, dataFile, **resamplingParameter); # transform points points = transformPoints(points, transformDirectory = alignmentDirectory, indices = False, resultDirectory = None); # save io.writePoints(transformedPointsFile, points); if verbose: refdata = io.readData(os.path.join(baseDirectory, 'Synthetic/test_iDISCO_reference.tif')); plot.plotOverlayPoints(0.01 * refdata, points)