[ITK] [ITK-users] SimpleITK JAVA ImageSeriesReader and PatchBasedDenoisingImageFilter and 4d images
ivan
ivan.granata.na at gmail.com
Thu Oct 6 08:32:21 EDT 2016
hi
can anyone help me how to write ImageSeriesReader in Java with simple itk
i wolud read a dicom series in a path and after apply a
PatchBasedDenoisingImageFilter
if possible i would work also with 4d image (multicomponent filter)
thx
this is my code
import org.itk.simple.*;
import java.util.Vector;
class PatchBasedDenoisingImageFilter {
public static void main(String argv[]) {
if ( argv.length < 5 ) {
System.out.println("Immetti prima: <input_img> <patch_radius> <smoothness>
<patch_number> <noise_sigma> <output_img>");
return;
}
org.itk.simple.ImageSeriesReader reader = new
org.itk.simple.ImageSeriesReader();
VectorString inputdicom = new VectorString();
inputdicom.toString(argv[0]);
reader.setFileNames(inputdicom);
//reader.setVectorString (argv[0]);
//reader.setFileNames(inputdicom);
Image img = reader.execute();
System.out.println(img.getDimension());
org.itk.simple.PatchBasedDenoisingImageFilter filter = new
org.itk.simple.PatchBasedDenoisingImageFilter();
filter.getAlwaysTreatComponentsAsEuclidean ();
boolean setKBE = false;
filter.setKernelBandwidthEstimation ( setKBE );
//filter.getKernelBandwidthUpdateFrequency ();
//filter.getKernelBandwidthFractionPixelsForEstimation ();
//filter.getKernelBandwidthMultiplicationFactor ();
//filter.getKernelBandwidthSigma ();
filter.setNoiseModel(org.itk.simple.PatchBasedDenoisingImageFilter.NoiseModelType.GAUSSIAN);
filter.getNumberOfIterations (); //cablato
filter.getSampleVariance ();
filter.setPatchRadius ( Long.valueOf ( argv[1] ).longValue() );
filter.setNoiseModelFidelityWeight ( Double.valueOf ( argv[2]
).doubleValue() );
if ( argv.length < 5 ) filter.getNumberOfSamplePatches ();
else filter.setNumberOfSamplePatches ( Long.valueOf ( argv[3] ).longValue()
);
if ( argv.length < 6 )
filter.getNoiseSigma ();
else filter.setNoiseSigma (Double.valueOf ( argv[4] ).doubleValue() );
Image blurredImg = filter.execute(img);
CastImageFilter caster = new CastImageFilter();
caster.setOutputPixelType( img.getPixelIDValue() );
Image castImg = caster.execute( blurredImg );
ImageFileWriter writer = new ImageFileWriter();
writer.setFileName(argv[5]);
writer.execute( castImg );
}
}
}
--
View this message in context: http://itk-users.7.n7.nabble.com/ITK-users-SimpleITK-JAVA-ImageSeriesReader-and-PatchBasedDenoisingImageFilter-and-4d-images-tp37645.html
Sent from the ITK - Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php
Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
More information about the Community
mailing list