Browse Source

filtro version 2.0

master
CarlosEGonzalezMorales 3 years ago
commit
7ef8b57e41
34 changed files with 3255 additions and 0 deletions
  1. BIN
      filtro_chido/Adaptive_Median_Filter-0.1.0.jar
  2. +73
    -0
      filtro_chido/build.xml
  3. +0
    -0
      filtro_chido/build/classes/.netbeans_automatic_build
  4. +0
    -0
      filtro_chido/build/classes/.netbeans_update_resources
  5. BIN
      filtro_chido/build/classes/SRM.class
  6. BIN
      filtro_chido/build/classes/filtro_chido/Filtrado$1.class
  7. BIN
      filtro_chido/build/classes/filtro_chido/Filtrado$2.class
  8. BIN
      filtro_chido/build/classes/filtro_chido/Filtrado$3.class
  9. BIN
      filtro_chido/build/classes/filtro_chido/Filtrado$4.class
  10. BIN
      filtro_chido/build/classes/filtro_chido/Filtrado.class
  11. +193
    -0
      filtro_chido/build/classes/filtro_chido/Filtrado.form
  12. BIN
      filtro_chido/build/classes/filtro_chido/Filtro_Chido.class
  13. BIN
      filtro_chido/build/classes/filtro_chido/Imagen.class
  14. BIN
      filtro_chido/build/classes/filtro_chido/SRM.class
  15. BIN
      filtro_chido/build/classes/filtro_chido/buscarImg$1.class
  16. BIN
      filtro_chido/build/classes/filtro_chido/buscarImg.class
  17. +50
    -0
      filtro_chido/build/classes/filtro_chido/buscarImg.form
  18. BIN
      filtro_chido/ij-1.50e.jar
  19. +3
    -0
      filtro_chido/manifest.mf
  20. +1771
    -0
      filtro_chido/nbproject/build-impl.xml
  21. +8
    -0
      filtro_chido/nbproject/genfiles.properties
  22. +0
    -0
      filtro_chido/nbproject/private/config.properties
  23. +8
    -0
      filtro_chido/nbproject/private/private.properties
  24. +11
    -0
      filtro_chido/nbproject/private/private.xml
  25. +95
    -0
      filtro_chido/nbproject/project.properties
  26. +15
    -0
      filtro_chido/nbproject/project.xml
  27. +0
    -0
      filtro_chido/src/Imagen.java
  28. +193
    -0
      filtro_chido/src/filtro_chido/Filtrado.form
  29. +266
    -0
      filtro_chido/src/filtro_chido/Filtrado.java
  30. +21
    -0
      filtro_chido/src/filtro_chido/Filtro_Chido.java
  31. +27
    -0
      filtro_chido/src/filtro_chido/Imagen.java
  32. +378
    -0
      filtro_chido/src/filtro_chido/SRM.java
  33. +50
    -0
      filtro_chido/src/filtro_chido/buscarImg.form
  34. +93
    -0
      filtro_chido/src/filtro_chido/buscarImg.java

BIN
filtro_chido/Adaptive_Median_Filter-0.1.0.jar View File


+ 73
- 0
filtro_chido/build.xml View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Filtro_Chido" default="default" basedir=".">
<description>Builds, tests, and runs the project Filtro_Chido.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Filtro_Chido-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

+ 0
- 0
filtro_chido/build/classes/.netbeans_automatic_build View File


+ 0
- 0
filtro_chido/build/classes/.netbeans_update_resources View File


BIN
filtro_chido/build/classes/SRM.class View File


BIN
filtro_chido/build/classes/filtro_chido/Filtrado$1.class View File


BIN
filtro_chido/build/classes/filtro_chido/Filtrado$2.class View File


BIN
filtro_chido/build/classes/filtro_chido/Filtrado$3.class View File


BIN
filtro_chido/build/classes/filtro_chido/Filtrado$4.class View File


BIN
filtro_chido/build/classes/filtro_chido/Filtrado.class View File


+ 193
- 0
filtro_chido/build/classes/filtro_chido/Filtrado.form View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="name" type="java.lang.String" value="Panel_Principal" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="name" type="java.lang.String" value="Panel_Original" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jButton1" max="32767" attributes="0"/>
<Component id="jButton2" max="32767" attributes="0"/>
<Component id="jButton3" max="32767" attributes="0"/>
<Component id="jButton4" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="jPanel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="176" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jButton3" min="-2" pref="33" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jButton2" min="-2" pref="36" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" pref="33" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton4" min="-2" pref="34" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="27" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="Panel_Vista_Previa" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="956" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="422" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="Panel_Original" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" pref="956" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" pref="422" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="VISTA PREVIA"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Median filter"/>
<Property name="name" type="java.lang.String" value="Radius_Button" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="Black &amp; White"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="text" type="java.lang.String" value="Cargar Imagen"/>
<Property name="name" type="java.lang.String" value="Cargar_Img" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton4">
<Properties>
<Property name="text" type="java.lang.String" value="SRM"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton4ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

BIN
filtro_chido/build/classes/filtro_chido/Filtro_Chido.class View File


BIN
filtro_chido/build/classes/filtro_chido/Imagen.class View File


BIN
filtro_chido/build/classes/filtro_chido/SRM.class View File


BIN
filtro_chido/build/classes/filtro_chido/buscarImg$1.class View File


BIN
filtro_chido/build/classes/filtro_chido/buscarImg.class View File


+ 50
- 0
filtro_chido/build/classes/filtro_chido/buscarImg.form View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="JMCImg" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="JMCImg" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JFileChooser" name="JMCImg">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

BIN
filtro_chido/ij-1.50e.jar View File


+ 3
- 0
filtro_chido/manifest.mf View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

+ 1771
- 0
filtro_chido/nbproject/build-impl.xml
File diff suppressed because it is too large
View File


+ 8
- 0
filtro_chido/nbproject/genfiles.properties View File

@ -0,0 +1,8 @@
build.xml.data.CRC32=7f4949f9
build.xml.script.CRC32=5771b5c4
build.xml.stylesheet.CRC32=f85dc8f2@1.99.0.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=7f4949f9
nbproject/build-impl.xml.script.CRC32=67d862f6
nbproject/build-impl.xml.stylesheet.CRC32=d549e5cc@1.99.0.48

+ 0
- 0
filtro_chido/nbproject/private/config.properties View File


+ 8
- 0
filtro_chido/nbproject/private/private.properties View File

@ -0,0 +1,8 @@
compile.on.save=true
do.depend=false
do.jar=true
file.reference.Adaptive_Median_Filter-0.1.0.jar=C:\\Users\\humme\\Documents\\NetBeansProjects\\Filtro_Chido\\Adaptive_Median_Filter-0.1.0.jar
file.reference.ij-1.50e.jar=C:\\Users\\humme\\Documents\\NetBeansProjects\\Filtro_Chido\\ij-1.50e.jar
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Users\\Pott\\AppData\\Roaming\\NetBeans\\12.4\\build.properties

+ 11
- 0
filtro_chido/nbproject/private/private.xml View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/humme/Documents/NetBeansProjects/Filtro_Chido/src/filtro_chido/SRM.java</file>
<file>file:/C:/Users/humme/Documents/NetBeansProjects/Filtro_Chido/src/filtro_chido/Filtro_Chido.java</file>
<file>file:/C:/Users/humme/Documents/NetBeansProjects/Filtro_Chido/src/filtro_chido/Filtrado.java</file>
</group>
</open-files>
</project-private>

+ 95
- 0
filtro_chido/nbproject/project.properties View File

@ -0,0 +1,95 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Filtro_Chido
application.vendor=humme
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Filtro_Chido.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.Adaptive_Median_Filter-0.1.0.jar=C:\\Users\\humme\\Downloads\\Adaptive_Median_Filter-0.1.0.jar
file.reference.Adaptive_Median_Filter-0.1.0.jar-1=Adaptive_Median_Filter-0.1.0.jar
file.reference.ij-1.50e.jar=C:\\Users\\humme\\Downloads\\ij-1.50e.jar
file.reference.ij-1.50e.jar-1=ij-1.50e.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.Adaptive_Median_Filter-0.1.0.jar}:\
${file.reference.ij-1.50e.jar}:\
${file.reference.Adaptive_Median_Filter-0.1.0.jar-1}:\
${file.reference.ij-1.50e.jar-1}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=filtro_chido.Filtro_Chido
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test

+ 15
- 0
filtro_chido/nbproject/project.xml View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>Filtro_Chido</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>

+ 0
- 0
filtro_chido/src/Imagen.java View File


+ 193
- 0
filtro_chido/src/filtro_chido/Filtrado.form View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="name" type="java.lang.String" value="Panel_Principal" noResource="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="name" type="java.lang.String" value="Panel_Original" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jButton1" max="32767" attributes="0"/>
<Component id="jButton2" max="32767" attributes="0"/>
<Component id="jButton3" max="32767" attributes="0"/>
<Component id="jButton4" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="jPanel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="176" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jButton3" min="-2" pref="33" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jButton2" min="-2" pref="36" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" pref="33" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton4" min="-2" pref="34" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="27" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="Panel_Vista_Previa" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="956" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="422" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="Panel_Original" noResource="true"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" pref="956" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" pref="422" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="14" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="VISTA PREVIA"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Median filter"/>
<Property name="name" type="java.lang.String" value="Radius_Button" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="Black &amp; White"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="text" type="java.lang.String" value="Cargar Imagen"/>
<Property name="name" type="java.lang.String" value="Cargar_Img" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton4">
<Properties>
<Property name="text" type="java.lang.String" value="SRM"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton4ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

+ 266
- 0
filtro_chido/src/filtro_chido/Filtrado.java View File

@ -0,0 +1,266 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package filtro_chido;
import com.HIT.weisongzhao.AdaptiveMedian;
import java.awt.Image;
import java.io.File;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileNameExtensionFilter;
/**
*
* srm1.setup = bufferredImage ;
*
*
*
*
*
* @author humme
*/
public class Filtrado extends javax.swing.JFrame {
/**
* Creates new form Filtrado
*/
public Filtrado() {
initComponents();
}
File archivo;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setName("Panel_Principal"); // NOI18N
jPanel1.setName("Panel_Original"); // NOI18N
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jPanel2.setName("Panel_Vista_Previa"); // NOI18N
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 956, Short.MAX_VALUE)
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 422, Short.MAX_VALUE)
);
jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jPanel3.setName("Panel_Original"); // NOI18N
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 956, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)
);
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel1.setText("VISTA PREVIA");
jButton1.setText("Median filter");
jButton1.setName("Radius_Button"); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Black & White");
jButton3.setText("Cargar Imagen");
jButton3.setName("Cargar_Img"); // NOI18N
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("SRM");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 176, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(23, 23, 23))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
AdaptiveMedian();
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Imagen image = new Imagen(jPanel3);
jPanel3.add(image).repaint();
int resultado;
buscarImg buscador = new buscarImg();
FileNameExtensionFilter formato = new FileNameExtensionFilter("JPG","PNG","GIF","jpg","png","gif");
buscador.JMCImg.setFileFilter(formato);
resultado = buscador.JMCImg.showOpenDialog(null);
if(JFileChooser.APPROVE_OPTION == resultado){
try{
archivo = buscador.JMCImg.getSelectedFile();
//jLDireccion.setText(archivo.getAbsolutePath());
ImageIcon imgIcon = new ImageIcon(archivo.toString());
Icon ico = new ImageIcon(imgIcon.getImage().getScaledInstance(jLabel2.getWidth(), jLabel2.getHeight(), Image.SCALE_DEFAULT) );
jLabel2.setIcon(ico);
}catch(Exception ex){
}
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
SRM();
}//GEN-LAST:event_jButton4ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Filtrado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Filtrado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Filtrado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Filtrado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Filtrado().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
// End of variables declaration//GEN-END:variables
private void AdaptiveMedian() {
AdaptiveMedian mediana =new AdaptiveMedian();
mediana.showDialog(null, null, null);
}
private void SRM (){
SRM srm1 = new SRM();
}
}

+ 21
- 0
filtro_chido/src/filtro_chido/Filtro_Chido.java View File

@ -0,0 +1,21 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package filtro_chido;
public class Filtro_Chido {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Filtrado fl = new Filtrado();
fl.show();
}
}

+ 27
- 0
filtro_chido/src/filtro_chido/Imagen.java View File

@ -0,0 +1,27 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package filtro_chido;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
class Imagen extends javax.swing.JPanel {
int x, y;
public Imagen(JPanel jPanel1) {
this.x = jPanel1.getWidth();
this.y = jPanel1.getHeight();
this.setSize(x, y);
}
public void paint(Graphics g, String img) {
ImageIcon Img = new ImageIcon(getClass().getResource("/Images/imagen1.png"));
g.drawImage(Img.getImage(), 0, 0, x, y, null);
}
}

+ 378
- 0
filtro_chido/src/filtro_chido/SRM.java View File

@ -0,0 +1,378 @@
package filtro_chido;
import ij.IJ;
import ij.ImagePlus;
import ij.ImageStack;
import ij.gui.GenericDialog;
import ij.plugin.filter.PlugInFilter;
import static ij.plugin.filter.PlugInFilter.DOES_8G;
import static ij.plugin.filter.PlugInFilter.NO_CHANGES;
import ij.process.ByteProcessor;
import ij.process.FloatProcessor;
import ij.process.ImageProcessor;
import ij.process.ShortProcessor;
import java.util.Arrays;
public class SRM implements PlugInFilter {
ImagePlus image;
public int setup(String arg, ImagePlus image) {
this.image = image;
return DOES_8G | NO_CHANGES;
}
public void run(ImageProcessor ip) {
boolean isStack = image.getStackSize() > 1;
GenericDialog gd = new GenericDialog("SRM");
gd.addNumericField("Q", Q, 2);
gd.addCheckbox("showAverages", true);
if (isStack)
gd.addCheckbox("3d", true);
gd.showDialog();
if (gd.wasCanceled())
return;
Q = (float)gd.getNextNumber();
boolean showAverages = gd.getNextBoolean();
boolean do3D = isStack ? gd.getNextBoolean() : false;
if (do3D)
srm3D(showAverages).show();
else
srm2D(ip, showAverages).show();
}
final float g = 256; // number of different intensity values
protected float Q = 25; //25; // complexity of the assumed distributions
protected float delta;
protected float factor, logDelta;
float[] average;
int[] count;
int[] regionIndex; // if < 0, it is -1 - actual_regionIndex
int[] nextNeighbor, neighborBucket;
protected ImagePlus srm3D(boolean showAverages) {
int w = image.getWidth(), h = image.getHeight();
int d = image.getStackSize();
delta = 1f / (6 * w * h * d);
factor = g * g / 2 / Q;
logDelta = 2f * (float)Math.log(6 * w * h * d);
IJ.showStatus("Initializing regions");
initializeRegions3D(w, h, d);
IJ.showStatus("Initializing neighbors");
initializeNeighbors3D(w, h, d);
IJ.showStatus("Merging neighbors");
mergeAllNeighbors3D(w, h);
IJ.showStatus("Making stack");
ImageStack stack = new ImageStack(w, h);
if (showAverages)
for (int k = 0; k < d; k++) {
int off = k * w * h;
float[] p = new float[w * h];
for (int i = 0; i < w * h; i++)
p[i] = average[getRegionIndex(i + off)];
stack.addSlice(null, new FloatProcessor(w, h,
p, null));
}
else {
int regionCount = consolidateRegions();
if (regionCount > 1<<16)
IJ.showMessage("Found " + regionCount
+ " regions, which does not fit"
+ " in 16-bit.");
for (int k = 0; k < d; k++) {
ImageProcessor ip;
int off = k * w * h;
if (regionCount > 1<<8) {
short[] p = new short[w * h];
for (int i = 0; i < p.length; i++)
p[i] = (short)regionIndex[i
+ off];
ip = new ShortProcessor(w, h, p, null);
}
else {
byte[] p = new byte[w * h];
for (int i = 0; i < p.length; i++)
p[i] = (byte)regionIndex[i
+ off];
ip = new ByteProcessor(w, h, p, null);
}
stack.addSlice(null, ip);
}
}
IJ.showStatus("");
String title = image.getTitle() + " (SRM3D Q=" + Q + ")";
return new ImagePlus(title, stack);
}
protected ImagePlus srm2D(ImageProcessor ip, boolean showAverages) {
int w = ip.getWidth(), h = ip.getHeight();
delta = 1f / (6 * w * h);
factor = g * g / 2 / Q;
logDelta = 2f * (float)Math.log(6 * w * h);
byte[] pixel = (byte[])ip.getPixels();
initializeRegions2D(pixel, ip.getWidth(), ip.getHeight());
initializeNeighbors2D(pixel, w, h);
mergeAllNeighbors2D(w);
if (showAverages) {
for (int i = 0; i < average.length; i++)
average[i] = average[getRegionIndex(i)];
ip = new FloatProcessor(w, h, average, null);
}
else {
int regionCount = consolidateRegions();
if (regionCount > 1<<8) {
if (regionCount > 1<<16)
IJ.showMessage("Found " + regionCount
+ " regions, which does not fit"
+ " in 16-bit.");
short[] pixel16 = new short[w * h];
for (int i = 0; i < pixel16.length; i++)
pixel16[i] = (short)regionIndex[i];
ip = new ShortProcessor(w, h, pixel16, null);
}
else {
pixel = new byte[w * h];
for (int i = 0; i < pixel.length; i++)
pixel[i] = (byte)regionIndex[i];
ip = new ByteProcessor(w, h, pixel, null);
}
}
String title = image.getTitle() + " (SRM Q=" + Q + ")";
return new ImagePlus(title, ip);
}
void initializeRegions2D(byte[] pixel, int w, int h) {
average = new float[w * h];
count = new int[w * h];
regionIndex = new int[w * h];
for (int i = 0; i < average.length; i++) {
average[i] = pixel[i] & 0xff;
count[i] = 1;
regionIndex[i] = i;
}
}
void initializeRegions3D(int w, int h, int d) {
average = new float[w * h * d];
count = new int[w * h * d];
regionIndex = new int[w * h * d];
for (int j = 0; j < d; j++) {
byte[] pixel =
(byte[])image.getStack().getProcessor(j
+ 1).getPixels();
int offset = j * w * h;
for (int i = 0; i < w * h; i++) {
average[offset + i] = pixel[i] & 0xff;
count[offset + i] = 1;
regionIndex[offset + i] = offset + i;
}
}
}
protected void addNeighborPair(int neighborIndex,
byte[] pixel, int i1, int i2) {
int difference = Math.abs((pixel[i1] & 0xff)
- (pixel[i2] & 0xff));
nextNeighbor[neighborIndex] = neighborBucket[difference];
neighborBucket[difference] = neighborIndex;
}
void initializeNeighbors2D(byte[] pixel, int w, int h) {
nextNeighbor = new int[2 * w * h];
// bucket sort
neighborBucket = new int[256];
Arrays.fill(neighborBucket, -1);
for (int j = h - 1; j >= 0; j--)
for (int i = w - 1; i >= 0; i--) {
int index = i + w * j;
int neighborIndex = 2 * index;
// vertical
if (j < h - 1)
addNeighborPair(neighborIndex + 1,
pixel, index, index + w);
// horizontal
if (i < w - 1)
addNeighborPair(neighborIndex,
pixel, index, index + 1);
}
}
protected void addNeighborPair(int neighborIndex,
byte[] pixel, byte[] nextPixel, int i) {
int difference = Math.abs((pixel[i] & 0xff)
- (nextPixel[i] & 0xff));
nextNeighbor[neighborIndex] = neighborBucket[difference];
neighborBucket[difference] = neighborIndex;
}
void initializeNeighbors3D(int w, int h, int d) {
nextNeighbor = new int[3 * w * h * d];
// bucket sort
neighborBucket = new int[256];
Arrays.fill(neighborBucket, -1);
byte[] nextPixel = null;
for (int k = d - 1; k >= 0; k--) {
byte[] pixel =
(byte[])image.getStack().getProcessor(k
+ 1).getPixels();
for (int j = h - 1; j >= 0; j--)
for (int i = w - 1; i >= 0; i--) {
int index = i + w * j;
int neighborIndex =
3 * (index + k * w * h);
// depth
if (nextPixel != null)
addNeighborPair(neighborIndex
+ 2, pixel,
nextPixel, index);
// vertical
if (j < h - 1)
addNeighborPair(neighborIndex
+ 1, pixel,
index, index + w);
// horizontal
if (i < w - 1)
addNeighborPair(neighborIndex,
pixel,
index, index + 1);
}
nextPixel = pixel;
}
}
// recursively find out the region index for this pixel
int getRegionIndex(int i) {
i = regionIndex[i];
while (i < 0)
i = regionIndex[-1 - i];
return i;
}
// should regions i1 and i2 be merged?
boolean predicate(int i1, int i2) {
float difference = average[i1] - average[i2];
/*
* This would be the non-relaxed predicate mentioned in the
* paper.
*
* return difference * difference <
factor * (1f / count[i1] + 1f / count[i2]);
*
*/
float log1 = (float)Math.log(1 + count[i1])
* (g < count[i1] ? g : count[i1]);
float log2 = (float)Math.log(1 + count[i2])
* (g < count[i2] ? g : count[i2]);
return difference * difference <
.1f * factor * ((log1 + logDelta) / count[i1]
+ ((log2 + logDelta) / count[i2]));
}
void mergeAllNeighbors2D(int w) {
for (int i = 0; i < neighborBucket.length; i++) {
int neighborIndex = neighborBucket[i];
while (neighborIndex >= 0) {
int i1 = neighborIndex / 2;
int i2 = i1
+ (0 == (neighborIndex & 1) ? 1 : w);
i1 = getRegionIndex(i1);
i2 = getRegionIndex(i2);
if (predicate(i1, i2))
mergeRegions(i1, i2);
neighborIndex = nextNeighbor[neighborIndex];
}
}
}
void mergeAllNeighbors3D(int w, int h) {
for (int i = 0; i < neighborBucket.length; i++) {
int neighborIndex = neighborBucket[i];
IJ.showProgress(i, neighborBucket.length);
while (neighborIndex >= 0) {
int i1 = neighborIndex / 3;
int i2 = i1
+ (0 == (neighborIndex % 3) ? 1 :
(1 == (neighborIndex % 3) ? w :
w * h));
i1 = getRegionIndex(i1);
i2 = getRegionIndex(i2);
if (i1 != i2 && predicate(i1, i2))
mergeRegions(i1, i2);
neighborIndex = nextNeighbor[neighborIndex];
}
}
IJ.showProgress(neighborBucket.length, neighborBucket.length);
}
void mergeRegions(int i1, int i2) {
if (i1 == i2)
return;
int mergedCount = count[i1] + count[i2];
float mergedAverage = (average[i1] * count[i1]
+ average[i2] * count[i2]) / mergedCount;
// merge larger index into smaller index
if (i1 > i2) {
average[i2] = mergedAverage;
count[i2] = mergedCount;
regionIndex[i1] = -1 - i2;
}
else {
average[i1] = mergedAverage;
count[i1] = mergedCount;
regionIndex[i2] = -1 - i1;
}
}
int consolidateRegions() {
int count = 0;
for (int i = 0; i < regionIndex.length; i++)
if (regionIndex[i] < 0)
regionIndex[i] =
regionIndex[-1 - regionIndex[i]];
else
regionIndex[i] = count++;
return count;
}
}

+ 50
- 0
filtro_chido/src/filtro_chido/buscarImg.form View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="JMCImg" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="JMCImg" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JFileChooser" name="JMCImg">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="9"/>
</AuxValues>
</Component>
</SubComponents>
</Form>

+ 93
- 0
filtro_chido/src/filtro_chido/buscarImg.java View File

@ -0,0 +1,93 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package filtro_chido;
/**
*
* @author Pott
*/
public class buscarImg extends javax.swing.JFrame {
/**
* Creates new form buscarImg
*/
public buscarImg() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
JMCImg = new javax.swing.JFileChooser();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(JMCImg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(JMCImg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(buscarImg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(buscarImg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(buscarImg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(buscarImg.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new buscarImg().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public static javax.swing.JFileChooser JMCImg;
// End of variables declaration//GEN-END:variables
}

Loading…
Cancel
Save