[ITK] question regarding simpleitk java wrapper

weiehome at sina.com weiehome at sina.com
Thu Jul 7 05:21:42 EDT 2016


Hi, Bradley

Thank you ! But how can i fill it with metadata information?
In c++, i can set metadatas manually using raw pointer to MetadataDictionary instance to achieve it, but in JAVA, it seems there is no such way of setting Image Metadata?

One function i found is CopyInformation(), however it requires Given input image has to be as same dimension as output one.
What i want is followings: 
1.First read dicoms volume data (CTs) from a folder recursively using SeriesReader
2. then convert all 3d volumes into my own data structure, then serialize it into bytes and passed to some remote server.
consider 1-2 steps are data import steps.
when exporting the data from remote server, i do :
3.read the bytes and deserialize bytes into self-defined image data structure.
4.convert data structure into itk image(3d)
remember when i do import, i actually extract all dicom tags i needed and put finally into data structure. 
So the question is how can i use Simpleitk java to read self-defined structure to recontruct dicom images including pixel data and metadata.
 
Best Regards,
Tom    



weiehome at sina.com
 
From: Lowekamp, Bradley (NIH/NLM/LHC) [C]
Date: 2016-07-06 21:00
To: weiehome at sina.com
CC: community at itk.org
Subject: Re: [ITK] question regarding simpleitk java wrapper
Hello, 

You can create it in a similar way to C++. The constructor does have required arguments to specify its size and pixel type.. You need to look at the Doxygen for the API documentation [1]. Also the SimpleITK Image will automatically allocated and initialized the data to 0 unlike an ITK image.

It would look something like the 

   Image img2 = new Image( 10, 10, PixelIDValueEnum.sitkInt16 );

    VectorDouble origin = new VectorDouble(img2.getDimension());
    origin.set( 0, 1.0);
    origin.set( 1, 2.0);
    img2.setOrigin(origin);

    System.out.format("%s", img2.toString());

HTH,
Brad

[1] https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1Image.html

On Jul 6, 2016, at 5:25 AM, weiehome at sina.com wrote:

Hi, 

Is there a possible way i can create an itk image in java just like in c++ :

Image itkImage = new Image();
itkImage.setOrgin( ... );
itkImage.setSpacing( ... );
itkImage.setRegion( ... );
itkImage.fill(0);

It seems in java i can get itk Image object either by reading files or from filters?

Regards, Tommi


_______________________________________________
Community mailing list
Community at itk.org
http://public.kitware.com/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160707/c908995d/attachment.html>


More information about the Community mailing list