1. Táirgí
  2.   Íomha
  3.   Java
  4.   ImgLib2
 
  

Leabharlann Foinse Oscailte Java le haghaidh Próiseáil Íomhá

API Próiseála Íomhá Iltoiseacha Ginearálta a chruthaíonn íomhánna nua, a mhodhnóidh íomhánna atá ann cheana féin,  ag obair le sonraí gann,  ag dúbláil íomhá atá ann cheana ag baint úsáide as API Java Saor in Aisce.

Tugann leabharlann foinse oscailte ImgLib2 an cumas d’fhorbróirí bogearraí íomhánna a chruthú agus a ionramháil laistigh dá n-aipeanna Java. Tairgeann an leabharlann dearadh comhéadan-tiomáinte a chuireann ar chumas úsáideoirí cineálacha sonraí uimhriúla agus neamh-uimhriúla a úsáid gan stró laistigh dá bhfeidhmchláir féin.

Is leabharlann próiseála íomhá iltoiseach ginearálta í an ImgLib2 a sholáthraíonn tacaíocht do roinnt gnéithe tábhachtacha a bhaineann le próiseáil íomhá, mar shampla íomhánna nua a chruthú, íomhánna atá ann cheana a mhodhnú, íomhánna atá ann cheana a oscailt agus a léamh, oibriú le sonraí gann, íomhánna atá ann cheana a dhúbailt, Cineálach sonraí íomhá a chóipeáil, sféar a tharraingt, tacaíocht idirshuímh agus go leor eile.

Tá an leabharlann an-éasca le húsáid agus seachnaíonn sí castachtaí nach bhfuil gá leo agus mar sin is féidir le forbróirí díriú ar bhunbhrí an algartam agus a gcuid tionscadal á bhforbairt. Is é an rud is fearr faoin leabharlann ná go bhfuil sí neamhspleách ar thoise agus ligeann sé d’úsáideoirí a gcód a chur in iúl ar bhealach is féidir a chur i bhfeidhm ar shonraí lántoiseacha. Níl obair na leabharlainne teoranta d’íomhánna amháin ach tá samplaí ag obair ar sheichimh RNA freisin.

Previous Next

Tús a chur le ImgLib2

Is é an bealach is éasca agus molta ImgLib2 a shuiteáil trí GitHub.

Suiteáil ImgLib2 trí GitHub

go get -u github.com/imglib/imglib2.git 

Íomhánna Nua a Chruthú trí Java

Áiríodh sa leabharlann foinse oscailte Java ImgLib2 tacaíocht chun íomhá nua a chruthú ón tús gan ach cúpla líne de chód Java. Ag baint úsáide as leabharlann ImgLib2, is féidir leat cineálacha éagsúla íomhánna a chruthú, mar shampla íomhánna simplí, íomhánna 3D, ImgFactory & níos mó. Is féidir leat freisin íomhánna de na híomhánna atá ann cheana féin a mhodhnú le cúpla líne de chód.

Cruthaigh Íomhánna Nua trí Java API


        public Example1c()
        {
            // create the ImgFactory based on cells (cellsize = 5x5x5...x5) that will
            // instantiate the Img
            final ImgFactory< FloatType > imgFactory = new CellImgFactory<>( new FloatType(), 5 );
            // create an 3d-Img with dimensions 20x30x40 (here cellsize is 5x5x5)Ø
            final Img< FloatType > img1 = imgFactory.create( 20, 30, 40 );
            // create another image with the same size. Note that the input provides the size for the new image as it implements the Interval interface
            final Img< FloatType > img2 = imgFactory.create( img1 );
            // display both (but they are empty)
            ImageJFunctions.show( img1 );
            ImageJFunctions.show( img2 );
        }

Dúbailt Íomhá trí Java API

Tá feidhmiúlacht le haghaidh dúbailt íomhá ag baint úsáide as orduithe Java san áireamh sa leabharlann ImgLib2. Is féidir leat cóip a dhéanamh go héasca den íomhá atá ann cheana féin. Is féidir leat Cúrsóirí a fhostú chun an tasc seo a bhaint amach. Is féidir leat an modh cóip a úsáid freisin atá ina mhodh cineálach agus is é an rud iontach ná go n-oibreoidh sé ar aon chineál Cineál.

Íomhá Dhúblach trí Java API


	public DuplicateImage() throws ImgIOException
	{
		// open with SCIFIO as a FloatType
		Img< FloatType > img = IO.openImgs( "DrosophilaWing.tif", new FloatType() ).get( 0 );
		// copy the image, as it is a generic method it also works with FloatType
		Img< FloatType > duplicate = copyImage( img );
		// display the copy
		ImageJFunctions.show( duplicate );
	}
        // Generic, type-agnostic method to create an identical copy of an Img
	public < T extends Type< T > > Img< T > copyImage( final Img< T > input )
	{
		// create a new Image with the same properties
		Img< T > output = input.factory().create( input );
		// create a cursor for both images
		Cursor< T > cursorInput = input.cursor();
		Cursor< T > cursorOutput = output.cursor();
		// iterate over the input
		while ( cursorInput.hasNext())
		{
			// move both cursors forward by one pixel
			cursorInput.fwd();
			cursorOutput.fwd();
			// set the value of this pixel of the output image to the same as the input,
			// every Type supports T.set( T type )
			cursorOutput.get().set( cursorInput.get() );
		}
		// return the copy
		return output;
	}

Féach ar Íomhánna go páirteach trí Java

Cuireann an leabharlann ImgLib2 saor in aisce ar chumas forbróirí bogearraí gan ach roinnt codanna den íomhá a thaispeáint taobh istigh dá gcuid apps trí chúpla líne de chód Java. Tá radharcanna an-chumhachtach agus is féidir leat iad a úsáid chun codanna roghnaithe de na híomhánna a thaispeáint, radharc rothlaithe a thaispeáint, agus beagán rudaí eile. Is féidir le radhairc a bheith Randamach Inrochtana, Eatramh, agus mar sin is féidir iad a dhéanamh Inite.

Bainistíocht Sonraí gann

Tugann an leabharlann ImgLib2 saor in aisce an cumas d’fhorbróirí bogearraí oibriú le sonraí gann ag baint úsáide as cód Java. Tá dhá scéim idirshuímh curtha ar fáil ag an leabharlann chun sonraí tearca a thaispeáint. Is féidir le húsáideoirí luach a ríomh do gach suíomh sa spás trí luach an tsampla is gaire nó luach idirshuite, ualaithe ó na comharsana is gaire k a thabhairt ar ais chuig an suíomh samplach.

Oibrigh le Sonraí Teorainneacha taobh istigh d’Aipeanna Java


        // Working with sparse data
	public SparseExample()
	{
		// the interval in which to create random points
		FinalInterval interval = new FinalInterval( new long[] { 375, 200 } );
		// create an IterableRealInterval
		IterableRealInterval< FloatType > realInterval = createRandomPoints( interval, 250 );
		// using nearest neighbor search we will be able to return a value an any position in space
		NearestNeighborSearch< FloatType > search =
			new NearestNeighborSearchOnKDTree<>(
				new KDTree<>( realInterval ) );
		// make it into RealRandomAccessible using nearest neighbor search
		RealRandomAccessible< FloatType > realRandomAccessible =
			Views.interpolate( search, new NearestNeighborSearchInterpolatorFactory< FloatType >() );
		// convert it into a RandomAccessible which can be displayed
		RandomAccessible< FloatType > randomAccessible = Views.raster( realRandomAccessible );
		// set the initial interval as area to view
		RandomAccessibleInterval< FloatType > view = Views.interval( randomAccessible, interval );
		// display the view
		ImageJFunctions.show( view );
		// compute a gauss on it
		Img< FloatType > convolved = new ArrayImgFactory<>( new FloatType() ).create( interval );
		Gauss.inFloat( new double[] { 3, 3 }, view, interval, convolved,
			new Point( view.numDimensions() ), convolved.factory() );
		// display the view
		ImageJFunctions.show( convolved );
	}
 Gaeilge