net.imglib2.type.numeric.complex.ComplexDoubleType Java Examples

The following examples show how to use net.imglib2.type.numeric.complex.ComplexDoubleType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FFTTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testPadShiftKernel() {
	long[] dims = new long[] { 1024, 1024 };
	Img<ComplexDoubleType> test = ops.create().img(new FinalDimensions(dims),
		new ComplexDoubleType());

	RandomAccessibleInterval<ComplexDoubleType> shift =
		(RandomAccessibleInterval<ComplexDoubleType>) ops.run(
			PadShiftKernel.class, test, new FinalDimensions(dims));

	RandomAccessibleInterval<ComplexDoubleType> shift2 =
		(RandomAccessibleInterval<ComplexDoubleType>) ops.run(
			PadShiftKernelFFTMethods.class, test, new FinalDimensions(dims));

	// assert there was no additional padding done by PadShiftKernel
	assertEquals(1024, shift.dimension(0));
	// assert that PadShiftKernelFFTMethods padded to the FFTMethods fast size
	assertEquals(1120, shift2.dimension(0));

}
 
Example #2
Source File: CreateNativeTypeTest.java    From imagej-ops with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Test
public void testCreateNativeType() {

	// default
	Object type = ops.run(DefaultCreateNativeType.class);
	assertEquals(type.getClass(), DoubleType.class);

	// FloatType
	type = ops.run(CreateNativeTypeFromClass.class, FloatType.class);
	assertEquals(type.getClass(), FloatType.class);

	// ComplexFloatType
	type = ops.run(CreateNativeTypeFromClass.class, ComplexFloatType.class);
	assertEquals(type.getClass(), ComplexFloatType.class);

	// DoubleType
	type = ops.run(CreateNativeTypeFromClass.class, DoubleType.class);
	assertEquals(type.getClass(), DoubleType.class);

	// ComplexDoubleType
	type = ops.run(CreateNativeTypeFromClass.class, ComplexDoubleType.class);
	assertEquals(type.getClass(), ComplexDoubleType.class);

}
 
Example #3
Source File: DefaultJsonServiceTest.java    From imagej-server with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeSpecialTypes() throws Exception {
	// MixIns and special types are tested together here. Could separate them if
	// needed in the future.
	final LinkedHashMap<String, Object> outputs = new LinkedHashMap<>();
	final IntType intType = new IntType(1);
	final ByteType byteType = new ByteType((byte) 1);
	final ShortType shortType = new ShortType((short) 1);
	final LongType longType = new LongType(1L);
	final FloatType floatType = new FloatType(1.5f);
	final DoubleType doubleType = new DoubleType(1.5d);
	final ComplexDoubleType complexDoubleType = new ComplexDoubleType(1.5, 2.5);
	final Img<ByteType> img0 = Imgs.create(new ArrayImgFactory<>(byteType),
		Intervals.createMinMax(0, 10, 0, 10), byteType);
	final Img<ByteType> img1 = Imgs.create(new PlanarImgFactory<>(byteType),
		Intervals.createMinMax(0, 10, 0, 10), byteType);
	final Foo foo = new Foo("test string");
	outputs.put("intType", intType);
	outputs.put("byteType", byteType);
	outputs.put("shortType", shortType);
	outputs.put("longType", longType);
	outputs.put("floatType", floatType);
	outputs.put("doubleType", doubleType);
	outputs.put("complexDoubleType", complexDoubleType);
	outputs.put("img0", img0);
	outputs.put("img1", img1);
	outputs.put("foo", foo);

	final String normalized = mapper.writeValueAsString(mapper.readValue(
		fixture("fixtures/outputs/specialTypes.json"), Object.class));

	assertEquals(jsonService.parseObject(outputs), normalized);
}
 
Example #4
Source File: JuliaRealRandomAccessible.java    From BigStitcher with GNU General Public License v2.0 5 votes vote down vote up
public JuliaRealRandomAccessible(
		final ComplexDoubleType c,
		final int maxIterations,
		final int maxAmplitude,
		final int numDimensions)
{
	this.c = c;
	this.maxIterations = maxIterations;
	this.maxAmplitude = maxAmplitude;
	this.numDismensions = numDimensions;
}
 
Example #5
Source File: CreateNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Convenience wrapper to create an {@link Img} of type {@link ComplexDoubleType}
 * with a Gabor kernel.
 */
@OpMethod(
	op = net.imagej.ops.create.kernelGabor.CreateKernelGaborComplexDoubleType.class)
public RandomAccessibleInterval<ComplexDoubleType>
	kernelGaborComplexDouble(final double[] sigmas, final double... period)
{
	@SuppressWarnings("unchecked")
	final RandomAccessibleInterval<ComplexDoubleType> result =
		(RandomAccessibleInterval<ComplexDoubleType>) ops().run(
			net.imagej.ops.create.kernelGabor.CreateKernelGaborComplexDoubleType.class,
			sigmas, period);
	return result;
}
 
Example #6
Source File: CreateNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Convenience wrapper to create an {@link Img} of type {@link ComplexDoubleType}
 * with an isotropic Gabor kernel.
 */
@OpMethod(
	op = net.imagej.ops.create.kernelGabor.CreateKernelGaborIsotropicComplexDoubleType.class)
public RandomAccessibleInterval<ComplexDoubleType>
	kernelGaborComplexDouble(final Double sigma, final double... period)
{
	@SuppressWarnings("unchecked")
	final RandomAccessibleInterval<ComplexDoubleType> result =
		(RandomAccessibleInterval<ComplexDoubleType>) ops().run(
			net.imagej.ops.create.kernelGabor.CreateKernelGaborIsotropicComplexDoubleType.class,
			sigma, period);
	return result;
}
 
Example #7
Source File: ConvertNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.convert.ConvertImages.Cfloat64.class)
public <C extends ComplexType<C>> Img<ComplexDoubleType> cfloat64(
	final IterableInterval<C> in)
{
	@SuppressWarnings("unchecked")
	final Img<ComplexDoubleType> result = (Img<ComplexDoubleType>) ops().run(
		Ops.Convert.Cfloat64.class, in);
	return result;
}
 
Example #8
Source File: ConvertNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.convert.ConvertImages.Cfloat64.class)
public <C extends ComplexType<C>> Img<ComplexDoubleType> cfloat64(
	final Img<ComplexDoubleType> out, final IterableInterval<C> in)
{
	@SuppressWarnings("unchecked")
	final Img<ComplexDoubleType> result = (Img<ComplexDoubleType>) ops().run(
		Ops.Convert.Cfloat64.class, out, in);
	return result;
}
 
Example #9
Source File: CreateKernelGaborComplexDoubleType.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public BinaryFunctionOp<double[], double[], RandomAccessibleInterval<ComplexDoubleType>>
	createWorker(final double[] t1, final double[] t2)
{
	return (BinaryFunctionOp) Functions.binary(ops(),
		Ops.Create.KernelGabor.class, RandomAccessibleInterval.class,
		double[].class, double[].class, new ComplexDoubleType());
}
 
Example #10
Source File: ConvertNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@OpMethod(op = net.imagej.ops.convert.ConvertTypes.ComplexToCfloat64.class)
public <C extends ComplexType<C>> ComplexDoubleType cfloat64(
	final ComplexDoubleType out, final C in)
{
	final ComplexDoubleType result = (ComplexDoubleType) ops().run(
		Ops.Convert.Cfloat64.class, out, in);
	return result;
}
 
Example #11
Source File: CreateKernelGaborIsotropicComplexDoubleType.java    From imagej-ops with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public BinaryFunctionOp<Double, double[], RandomAccessibleInterval<ComplexDoubleType>>
	createWorker(final Double t1, final double[] t2)
{
	return (BinaryFunctionOp) Functions.binary(ops(),
		Ops.Create.KernelGabor.class, RandomAccessibleInterval.class,
		Double.class, double[].class, new ComplexDoubleType());
}
 
Example #12
Source File: ConvertNamespace.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@OpMethod(op = net.imagej.ops.convert.ConvertTypes.ComplexToCfloat64.class)
public <C extends ComplexType<C>> ComplexDoubleType cfloat64(final C in) {
	final ComplexDoubleType result = (ComplexDoubleType) ops().run(
		Ops.Convert.Cfloat64.class, in);
	return result;
}
 
Example #13
Source File: FractalSpimDataGenerator.java    From BigStitcher with GNU General Public License v2.0 4 votes vote down vote up
public void addFractal(AffineGet transform)
{
	JuliaRealRandomAccessible fractalRA = new JuliaRealRandomAccessible(new ComplexDoubleType( -0.4, 0.6 ), 300, 300, numDimensions);
	fractalsRA.addRAble(Views.raster( RealViews.affineReal( fractalRA, transform )));
}
 
Example #14
Source File: ConvertTypes.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void compute(final C input, final ComplexDoubleType output) {
	output.set(input.getRealDouble(), input.getImaginaryDouble());
}
 
Example #15
Source File: ConvertTypes.java    From imagej-ops with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public ComplexDoubleType createOutput(final C input) {
	return new ComplexDoubleType();
}
 
Example #16
Source File: JuliaRealRandomAccessible.java    From BigStitcher with GNU General Public License v2.0 4 votes vote down vote up
public JuliaRealRandomAccess()
{
	super( numDismensions );
	a = new ComplexDoubleType();
	t = new LongType();
}
 
Example #17
Source File: JuliaRealRandomAccessible.java    From BigStitcher with GNU General Public License v2.0 4 votes vote down vote up
public void setC( final ComplexDoubleType c )
{
	this.c.set( c );
}
 
Example #18
Source File: JuliaRealRandomAccessible.java    From BigStitcher with GNU General Public License v2.0 4 votes vote down vote up
public JuliaRealRandomAccessible()
{
	this(new ComplexDoubleType(),50,4096,3);
}