示例#1
0
def runResampling(parameter):
    """Resample data"""
    
    rp = parameter.Resampling;
    
    im = rp.Source;
    if im is None:    
        im = parameter.DataSource.ImageFile;
    
    resampleData(im, outputFile = rp.ResampledFile, 
                 resolutionData = rp.ResolutionData, resolutionReference = rp.ResolutionReference,
                 processingDirectory = None, processes = rp.Processes, cleanup = True, orientation = rp.Orientation);
    
    return rp.ResampledFile;
示例#2
0
def runResampling(parameter):
    """Resample data"""

    rp = parameter.Resampling

    im = rp.Source
    if im is None:
        im = parameter.DataSource.ImageFile

    resampleData(im,
                 outputFile=rp.ResampledFile,
                 resolutionData=rp.ResolutionData,
                 resolutionReference=rp.ResolutionReference,
                 processingDirectory=None,
                 processes=rp.Processes,
                 cleanup=True,
                 orientation=rp.Orientation)

    return rp.ResampledFile
    #Resolution of the raw data (in um / pixel) as (x,y,z)
    "resolutionSource" : (5, 5, 3),

    #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),
    
    #number of processes to use in parallel:
    "processes" : 4,
    };


resampledImage = resampleData(**resamplingParameter)
print("Resampled image saved as %s" % resampledImage)


# create reference for further tests
#import shutil
#shutil.copyfile(resampledImage, os.path.join(baseDirectory, 'Synthetic/test_iDISCO_reference.tif'))
resamplingParameter["sink"] = os.path.join(baseDirectory, 'Synthetic/test_iDISCO_reference.tif');
resamplingParameter["resolutionSink"] = (12, 12, 5);
referenceImage = resampleData(**resamplingParameter);
print("Reference image saved as %s" % referenceImage)


# use None as sink to get the numpy array
resamplingParameter["sink"] = None
referenceImage = resampleData(**resamplingParameter);
    #Resolution of the raw data (in um / pixel) as (x,y,z)
    "resolutionSource" : (5, 5, 3),

    #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),
    
    #number of processes to use in parallel:
    "processes" : 4,
    };


resampledImage = resampleData(**resamplingParameter)
print "Resampled image saved as %s" % resampledImage


# create reference for further tests
#import shutil
#shutil.copyfile(resampledImage, os.path.join(baseDirectory, 'Synthetic/test_iDISCO_reference.tif'))
resamplingParameter["sink"] = os.path.join(baseDirectory, 'Synthetic/test_iDISCO_reference.tif');
resamplingParameter["resolutionSink"] = (12, 12, 5);
referenceImage = resampleData(**resamplingParameter);
print "Reference image saved as %s" % referenceImage


# use None as sink to get the numpy array
resamplingParameter["sink"] = None
referenceImage = resampleData(**resamplingParameter);