Hi Listers
Is there a way that I can get imageJ to create an XML file? Have tried the saveTextFileDemo but not been very successful (my java is not the best). Thanks in advance Rhod |
I should have probably stated that its XML text not images.
Script is below <?xml version="1.0" encoding="UTF-8"?> <ZereneStackerBatchScript> <WrittenBy value="Zerene Stacker 1.02 Build T200912272255" /> <BatchQueue> <Batches length="1"> <Batch> <Sources length="1"> <Source value="C:\Documents and Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies 430.2\Sample 2\15 at 10\Registered" /> </Sources> <ProjectDispositionCode value="101" /> <Tasks length="2"> <Task> <OutputImageDispositionCode value="4" /> <OutputImagesDesignatedFolder value="C:\Documents and Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies 430.2\Sample 2\Output" /> <Preferences> <AlignmentControl.AlignmentSettingsChanged value="false" /> <AlignmentControl.AllowRotation value="true" /> <AlignmentControl.AllowScale value="true" /> <AlignmentControl.AllowShiftX value="true" /> <AlignmentControl.AllowShiftY value="true" /> <AlignmentControl.BrightnessSettingsChanged value="false" /> <AlignmentControl.CorrectBrightness value="true" /> <AlignmentControl.MaxRelDegRotation value="20.0" /> <AlignmentControl.MaxRelPctScale value="20.0" /> <AlignmentControl.MaxRelPctShiftX value="20.0" /> <AlignmentControl.MaxRelPctShiftY value="20.0" /> <AlignmentControl.Order.Automatic value="true" /> <AlignmentControl.Order.NarrowFirst value="true" /> <AllowReporting.UsageStatistics value="true" /> <ColorManagement.InputOption value="Use_EXIF_and_DCF_rules" /> <ColorManagement.InputOption.AssumedProfile value="sRGB IEC61966-2.1" /> <ColorManagement.OutputOption value="CopyInput" /> <DepthMapControl.ContrastThresholdLevel value="1.9073487E-7" /> <DepthMapControl.ContrastThresholdPercentile value="0.0" /> <DepthMapControl.EstimationRadius value="5" /> <DepthMapControl.SmoothingRadius value="2" /> <DepthMapControl.UseFixedContrastThresholdLevel value="false" /> <DepthMapControl.UseFixedContrastThresholdPercentile value="true" /> <FileIO.UseExternalTIFFReader value="false" /> <OutputImageNaming.Template value="{datetime} ZS {method}" /> <Prerotation.Degrees value="0" /> <Prerotation.Selected value="false" /> <Presize.UserSetting.Scale value="1.0" /> <Presize.UserSetting.Selected value="false" /> <Presize.Working.Scale value="1.0" /> <PyramidControl.GritSuppressionMethod value="1" /> <PyramidControl.RetainUDRImage value="false" /> <SaveImage.BitsPerColor value="16" /> <SaveImage.CompressionQuality value="0.75" /> <SaveImage.FileType value="tif" /> <SaveImage.RescaleImageToAvoidOverflow value="false" /> <SkewSequence.FirstImage.MaximumShiftXPct value="-3.0" /> <SkewSequence.FirstImage.MaximumShiftYPct value="0.0" /> <SkewSequence.LastImage.MaximumShiftXPct value="3.0" /> <SkewSequence.LastImage.MaximumShiftYPct value="0.0" /> <SkewSequence.NumberOfOutputImages value="3" /> <SkewSequence.Selected value="false" /> <StereoOrdering.LeftRightIndexSeparation value="1" /> </Preferences> <TaskIndicatorCode value="1" /> </Task> <Task> <OutputImageDispositionCode value="4" /> <OutputImagesDesignatedFolder value="C:\Documents and Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies 430.2\Sample 2\Output" /> <Preferences> <AlignmentControl.AlignmentSettingsChanged value="false" /> <AlignmentControl.AllowRotation value="true" /> <AlignmentControl.AllowScale value="true" /> <AlignmentControl.AllowShiftX value="true" /> <AlignmentControl.AllowShiftY value="true" /> <AlignmentControl.BrightnessSettingsChanged value="false" /> <AlignmentControl.CorrectBrightness value="true" /> <AlignmentControl.MaxRelDegRotation value="20.0" /> <AlignmentControl.MaxRelPctScale value="20.0" /> <AlignmentControl.MaxRelPctShiftX value="20.0" /> <AlignmentControl.MaxRelPctShiftY value="20.0" /> <AlignmentControl.Order.Automatic value="true" /> <AlignmentControl.Order.NarrowFirst value="true" /> <AllowReporting.UsageStatistics value="true" /> <ColorManagement.InputOption value="Use_EXIF_and_DCF_rules" /> <ColorManagement.InputOption.AssumedProfile value="sRGB IEC61966-2.1" /> <ColorManagement.OutputOption value="CopyInput" /> <DepthMapControl.ContrastThresholdLevel value="1.9073487E-7" /> <DepthMapControl.ContrastThresholdPercentile value="0.0" /> <DepthMapControl.EstimationRadius value="5" /> <DepthMapControl.SmoothingRadius value="2" /> <DepthMapControl.UseFixedContrastThresholdLevel value="false" /> <DepthMapControl.UseFixedContrastThresholdPercentile value="true" /> <FileIO.UseExternalTIFFReader value="false" /> <OutputImageNaming.Template value="{datetime} ZS {method}" /> <Prerotation.Degrees value="0" /> <Prerotation.Selected value="false" /> <Presize.UserSetting.Scale value="1.0" /> <Presize.UserSetting.Selected value="false" /> <Presize.Working.Scale value="1.0" /> <PyramidControl.GritSuppressionMethod value="1" /> <PyramidControl.RetainUDRImage value="false" /> <SaveImage.BitsPerColor value="16" /> <SaveImage.CompressionQuality value="0.75" /> <SaveImage.FileType value="tif" /> <SaveImage.RescaleImageToAvoidOverflow value="false" /> <SkewSequence.FirstImage.MaximumShiftXPct value="-3.0" /> <SkewSequence.FirstImage.MaximumShiftYPct value="0.0" /> <SkewSequence.LastImage.MaximumShiftXPct value="3.0" /> <SkewSequence.LastImage.MaximumShiftYPct value="0.0" /> <SkewSequence.NumberOfOutputImages value="3" /> <SkewSequence.Selected value="false" /> <StereoOrdering.LeftRightIndexSeparation value="1" /> </Preferences> <TaskIndicatorCode value="2" /> </Task> </Tasks> </Batch> </Batches> </BatchQueue> </ZereneStackerBatchScript> |
i dont think ImageJ includes own classes for reading and writing XML files, instead you can use the java standard classes like: javax.xml.stream.XMLStreamWriter; (thats at least how i do it in one off my projects)
// Tomas 18 jan 2010 kl. 13.00 skrev Wilson R S (AT): > I should have probably stated that its XML text not images. > Script is below > > > <?xml version="1.0" encoding="UTF-8"?> > <ZereneStackerBatchScript> > <WrittenBy value="Zerene Stacker 1.02 Build T200912272255" /> > <BatchQueue> > <Batches length="1"> > <Batch> > <Sources length="1"> > <Source value="C:\Documents and > Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies > 430.2\Sample 2\15 at 10\Registered" /> > </Sources> > <ProjectDispositionCode value="101" /> > <Tasks length="2"> > <Task> > <OutputImageDispositionCode value="4" /> > <OutputImagesDesignatedFolder value="C:\Documents and > Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies > 430.2\Sample 2\Output" /> > <Preferences> > <AlignmentControl.AlignmentSettingsChanged value="false" > /> > <AlignmentControl.AllowRotation value="true" /> > <AlignmentControl.AllowScale value="true" /> > <AlignmentControl.AllowShiftX value="true" /> > <AlignmentControl.AllowShiftY value="true" /> > <AlignmentControl.BrightnessSettingsChanged value="false" > /> > <AlignmentControl.CorrectBrightness value="true" /> > <AlignmentControl.MaxRelDegRotation value="20.0" /> > <AlignmentControl.MaxRelPctScale value="20.0" /> > <AlignmentControl.MaxRelPctShiftX value="20.0" /> > <AlignmentControl.MaxRelPctShiftY value="20.0" /> > <AlignmentControl.Order.Automatic value="true" /> > <AlignmentControl.Order.NarrowFirst value="true" /> > <AllowReporting.UsageStatistics value="true" /> > <ColorManagement.InputOption > value="Use_EXIF_and_DCF_rules" /> > <ColorManagement.InputOption.AssumedProfile value="sRGB > IEC61966-2.1" /> > <ColorManagement.OutputOption value="CopyInput" /> > <DepthMapControl.ContrastThresholdLevel > value="1.9073487E-7" /> > <DepthMapControl.ContrastThresholdPercentile value="0.0" > /> > <DepthMapControl.EstimationRadius value="5" /> > <DepthMapControl.SmoothingRadius value="2" /> > <DepthMapControl.UseFixedContrastThresholdLevel > value="false" /> > <DepthMapControl.UseFixedContrastThresholdPercentile > value="true" /> > <FileIO.UseExternalTIFFReader value="false" /> > <OutputImageNaming.Template value="{datetime} ZS {method}" > /> > <Prerotation.Degrees value="0" /> > <Prerotation.Selected value="false" /> > <Presize.UserSetting.Scale value="1.0" /> > <Presize.UserSetting.Selected value="false" /> > <Presize.Working.Scale value="1.0" /> > <PyramidControl.GritSuppressionMethod value="1" /> > <PyramidControl.RetainUDRImage value="false" /> > <SaveImage.BitsPerColor value="16" /> > <SaveImage.CompressionQuality value="0.75" /> > <SaveImage.FileType value="tif" /> > <SaveImage.RescaleImageToAvoidOverflow value="false" /> > <SkewSequence.FirstImage.MaximumShiftXPct value="-3.0" /> > <SkewSequence.FirstImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.LastImage.MaximumShiftXPct value="3.0" /> > <SkewSequence.LastImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.NumberOfOutputImages value="3" /> > <SkewSequence.Selected value="false" /> > <StereoOrdering.LeftRightIndexSeparation value="1" /> > </Preferences> > <TaskIndicatorCode value="1" /> > </Task> > <Task> > <OutputImageDispositionCode value="4" /> > <OutputImagesDesignatedFolder value="C:\Documents and > Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies > 430.2\Sample 2\Output" /> > <Preferences> > <AlignmentControl.AlignmentSettingsChanged value="false" > /> > <AlignmentControl.AllowRotation value="true" /> > <AlignmentControl.AllowScale value="true" /> > <AlignmentControl.AllowShiftX value="true" /> > <AlignmentControl.AllowShiftY value="true" /> > <AlignmentControl.BrightnessSettingsChanged value="false" > /> > <AlignmentControl.CorrectBrightness value="true" /> > <AlignmentControl.MaxRelDegRotation value="20.0" /> > <AlignmentControl.MaxRelPctScale value="20.0" /> > <AlignmentControl.MaxRelPctShiftX value="20.0" /> > <AlignmentControl.MaxRelPctShiftY value="20.0" /> > <AlignmentControl.Order.Automatic value="true" /> > <AlignmentControl.Order.NarrowFirst value="true" /> > <AllowReporting.UsageStatistics value="true" /> > <ColorManagement.InputOption > value="Use_EXIF_and_DCF_rules" /> > <ColorManagement.InputOption.AssumedProfile value="sRGB > IEC61966-2.1" /> > <ColorManagement.OutputOption value="CopyInput" /> > <DepthMapControl.ContrastThresholdLevel > value="1.9073487E-7" /> > <DepthMapControl.ContrastThresholdPercentile value="0.0" > /> > <DepthMapControl.EstimationRadius value="5" /> > <DepthMapControl.SmoothingRadius value="2" /> > <DepthMapControl.UseFixedContrastThresholdLevel > value="false" /> > <DepthMapControl.UseFixedContrastThresholdPercentile > value="true" /> > <FileIO.UseExternalTIFFReader value="false" /> > <OutputImageNaming.Template value="{datetime} ZS {method}" > /> > <Prerotation.Degrees value="0" /> > <Prerotation.Selected value="false" /> > <Presize.UserSetting.Scale value="1.0" /> > <Presize.UserSetting.Selected value="false" /> > <Presize.Working.Scale value="1.0" /> > <PyramidControl.GritSuppressionMethod value="1" /> > <PyramidControl.RetainUDRImage value="false" /> > <SaveImage.BitsPerColor value="16" /> > <SaveImage.CompressionQuality value="0.75" /> > <SaveImage.FileType value="tif" /> > <SaveImage.RescaleImageToAvoidOverflow value="false" /> > <SkewSequence.FirstImage.MaximumShiftXPct value="-3.0" /> > <SkewSequence.FirstImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.LastImage.MaximumShiftXPct value="3.0" /> > <SkewSequence.LastImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.NumberOfOutputImages value="3" /> > <SkewSequence.Selected value="false" /> > <StereoOrdering.LeftRightIndexSeparation value="1" /> > </Preferences> > <TaskIndicatorCode value="2" /> > </Task> > </Tasks> > </Batch> > </Batches> > </BatchQueue> > </ZereneStackerBatchScript> |
I there, tanks for that.
Is there an easier way for example outputting as a text file and then renaming and altering the file extension? Rhod -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Tomas Karlsson Sent: 18 January 2010 15:45 To: [hidden email] Subject: Re: Creating an XML file i dont think ImageJ includes own classes for reading and writing XML files, instead you can use the java standard classes like: javax.xml.stream.XMLStreamWriter; (thats at least how i do it in one off my projects) // Tomas 18 jan 2010 kl. 13.00 skrev Wilson R S (AT): > I should have probably stated that its XML text not images. > Script is below > > > <?xml version="1.0" encoding="UTF-8"?> > <ZereneStackerBatchScript> > <WrittenBy value="Zerene Stacker 1.02 Build T200912272255" /> > <BatchQueue> > <Batches length="1"> > <Batch> > <Sources length="1"> > <Source value="C:\Documents and > Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies > 430.2\Sample 2\15 at 10\Registered" /> > </Sources> > <ProjectDispositionCode value="101" /> > <Tasks length="2"> > <Task> > <OutputImageDispositionCode value="4" /> > <OutputImagesDesignatedFolder value="C:\Documents and > Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies > 430.2\Sample 2\Output" /> > <Preferences> > <AlignmentControl.AlignmentSettingsChanged value="false" > /> > <AlignmentControl.AllowRotation value="true" /> > <AlignmentControl.AllowScale value="true" /> > <AlignmentControl.AllowShiftX value="true" /> > <AlignmentControl.AllowShiftY value="true" /> > <AlignmentControl.BrightnessSettingsChanged value="false" > /> > <AlignmentControl.CorrectBrightness value="true" /> > <AlignmentControl.MaxRelDegRotation value="20.0" /> > <AlignmentControl.MaxRelPctScale value="20.0" /> > <AlignmentControl.MaxRelPctShiftX value="20.0" /> > <AlignmentControl.MaxRelPctShiftY value="20.0" /> > <AlignmentControl.Order.Automatic value="true" /> > <AlignmentControl.Order.NarrowFirst value="true" /> > <AllowReporting.UsageStatistics value="true" /> > <ColorManagement.InputOption > value="Use_EXIF_and_DCF_rules" /> > <ColorManagement.InputOption.AssumedProfile value="sRGB > IEC61966-2.1" /> > <ColorManagement.OutputOption value="CopyInput" /> > <DepthMapControl.ContrastThresholdLevel > value="1.9073487E-7" /> > <DepthMapControl.ContrastThresholdPercentile value="0.0" > /> > <DepthMapControl.EstimationRadius value="5" /> > <DepthMapControl.SmoothingRadius value="2" /> > <DepthMapControl.UseFixedContrastThresholdLevel > value="false" /> > <DepthMapControl.UseFixedContrastThresholdPercentile > value="true" /> > <FileIO.UseExternalTIFFReader value="false" /> > <OutputImageNaming.Template value="{datetime} ZS > /> > <Prerotation.Degrees value="0" /> > <Prerotation.Selected value="false" /> > <Presize.UserSetting.Scale value="1.0" /> > <Presize.UserSetting.Selected value="false" /> > <Presize.Working.Scale value="1.0" /> > <PyramidControl.GritSuppressionMethod value="1" /> > <PyramidControl.RetainUDRImage value="false" /> > <SaveImage.BitsPerColor value="16" /> > <SaveImage.CompressionQuality value="0.75" /> > <SaveImage.FileType value="tif" /> > <SaveImage.RescaleImageToAvoidOverflow value="false" /> > <SkewSequence.FirstImage.MaximumShiftXPct value="-3.0" /> > <SkewSequence.FirstImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.LastImage.MaximumShiftXPct value="3.0" /> > <SkewSequence.LastImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.NumberOfOutputImages value="3" /> > <SkewSequence.Selected value="false" /> > <StereoOrdering.LeftRightIndexSeparation value="1" /> > </Preferences> > <TaskIndicatorCode value="1" /> > </Task> > <Task> > <OutputImageDispositionCode value="4" /> > <OutputImagesDesignatedFolder value="C:\Documents and > Settings\rswilson\Desktop\ImageJ\Fusion Testing\Method 2\Prcies > 430.2\Sample 2\Output" /> > <Preferences> > <AlignmentControl.AlignmentSettingsChanged value="false" > /> > <AlignmentControl.AllowRotation value="true" /> > <AlignmentControl.AllowScale value="true" /> > <AlignmentControl.AllowShiftX value="true" /> > <AlignmentControl.AllowShiftY value="true" /> > <AlignmentControl.BrightnessSettingsChanged value="false" > /> > <AlignmentControl.CorrectBrightness value="true" /> > <AlignmentControl.MaxRelDegRotation value="20.0" /> > <AlignmentControl.MaxRelPctScale value="20.0" /> > <AlignmentControl.MaxRelPctShiftX value="20.0" /> > <AlignmentControl.MaxRelPctShiftY value="20.0" /> > <AlignmentControl.Order.Automatic value="true" /> > <AlignmentControl.Order.NarrowFirst value="true" /> > <AllowReporting.UsageStatistics value="true" /> > <ColorManagement.InputOption > value="Use_EXIF_and_DCF_rules" /> > <ColorManagement.InputOption.AssumedProfile value="sRGB > IEC61966-2.1" /> > <ColorManagement.OutputOption value="CopyInput" /> > <DepthMapControl.ContrastThresholdLevel > value="1.9073487E-7" /> > <DepthMapControl.ContrastThresholdPercentile value="0.0" > /> > <DepthMapControl.EstimationRadius value="5" /> > <DepthMapControl.SmoothingRadius value="2" /> > <DepthMapControl.UseFixedContrastThresholdLevel > value="false" /> > <DepthMapControl.UseFixedContrastThresholdPercentile > value="true" /> > <FileIO.UseExternalTIFFReader value="false" /> > <OutputImageNaming.Template value="{datetime} ZS > /> > <Prerotation.Degrees value="0" /> > <Prerotation.Selected value="false" /> > <Presize.UserSetting.Scale value="1.0" /> > <Presize.UserSetting.Selected value="false" /> > <Presize.Working.Scale value="1.0" /> > <PyramidControl.GritSuppressionMethod value="1" /> > <PyramidControl.RetainUDRImage value="false" /> > <SaveImage.BitsPerColor value="16" /> > <SaveImage.CompressionQuality value="0.75" /> > <SaveImage.FileType value="tif" /> > <SaveImage.RescaleImageToAvoidOverflow value="false" /> > <SkewSequence.FirstImage.MaximumShiftXPct value="-3.0" /> > <SkewSequence.FirstImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.LastImage.MaximumShiftXPct value="3.0" /> > <SkewSequence.LastImage.MaximumShiftYPct value="0.0" /> > <SkewSequence.NumberOfOutputImages value="3" /> > <SkewSequence.Selected value="false" /> > <StereoOrdering.LeftRightIndexSeparation value="1" /> > </Preferences> > <TaskIndicatorCode value="2" /> > </Task> > </Tasks> > </Batch> > </Batches> > </BatchQueue> > </ZereneStackerBatchScript> |
In reply to this post by Wilson R S (AT)
Hi All,
Have been plugin away at this (no pun intended) and have got to a working(ish) stage. My problem is that when outputting the file, the macro missing out line 2 and part of line 3. Everything else is working fine and as it supposed to. I was wondering if anyone could help. Have attached the code below, please note the output file needs to be viewed with note pad or similar. Rhod ------------------------------------------------------------------------ ------------------------- x = "E:\\ZereneBatch.xml"; t = "E:\\ZereneBatch.txt"; f = File.open(t); File.delete(x); print(f, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r"); File.append("<ZereneStackerBatchScript>\r",t); File.append("<WrittenBy value=\"Zerene Stacker 1.02 Build T200912272255\" />\r",t); File.append("<BatchQueue>\r",t); File.append("<Batches length=\"1\">\r",t); File.append("<Batch>\r",t); File.append("<Sources length=\"1\">\r",t); File.append("<Source value=\"C:\\Documents and Settings\\rswilson\\Desktop\\ImageJ\\Fusion Testing\\Method 2\\Prcies 430.2\\Sample 2\\15 at 10\\Registered\" />\r",t); File.append("</Sources>\r",t); File.append("<ProjectDispositionCode value=\"101\" />\r",t); File.append("<Tasks length=\"2\">\r",t); File.append("<Task>\r",t); File.append("<OutputImageDispositionCode value=\"4\" />\r",t); File.append("<OutputImagesDesignatedFolder value=\"C:\\Documents and Settings\\rswilson\\Desktop\\ImageJ\\Fusion Testing\\Method 2\\Prcies 430.2\\Sample 2\\Output\" />\r",t); File.append("<Preferences>\r",t); File.append("<AlignmentControl.AlignmentSettingsChanged value=\"false\" />\r",t); File.append("<AlignmentControl.AllowRotation value=\"true\" />\r",t); File.append("<AlignmentControl.AllowScale value=\"true\" />\r",t); File.append("<AlignmentControl.AllowShiftX value=\"true\" />\r",t); File.append("<AlignmentControl.AllowShiftY value=\"true\" />\r",t); File.append("<AlignmentControl.BrightnessSettingsChanged value=\"false\" />\r",t); File.append("<AlignmentControl.CorrectBrightness value=\"true\" />\r",t); File.append("<AlignmentControl.MaxRelDegRotation value=\"20.0\" />\r",t); File.append("<AlignmentControl.MaxRelPctScale value=\"20.0\" />\r",t); File.append("<AlignmentControl.MaxRelPctShiftX value=\"20.0\" />\r",t); File.append("<AlignmentControl.MaxRelPctShiftY value=\"20.0\" />\r",t); File.append("<AlignmentControl.Order.Automatic value=\"true\" />\r",t); File.append("<AlignmentControl.Order.NarrowFirst value=\"true\" />\r",t); File.append("<AllowReporting.UsageStatistics value=\"true\" />\r",t); File.append("<ColorManagement.InputOption value=\"Use_EXIF_and_DCF_rules\" />\r",t); File.append("<ColorManagement.InputOption.AssumedProfile value=\"sRGB IEC61966-2.1\" />\r",t); File.append("<ColorManagement.OutputOption value=\"CopyInput\" />\r",t); File.append("<DepthMapControl.ContrastThresholdLevel value=\"1.9073487E-7\" />\r",t); File.append("<DepthMapControl.ContrastThresholdPercentile value=\"0.0\" />\r",t); File.append("<DepthMapControl.EstimationRadius value=\"5\" />\r",t); File.append("<DepthMapControl.SmoothingRadius value=\"2\" />\r",t); File.append("<DepthMapControl.UseFixedContrastThresholdLevel value=\"false\" />\r",t); File.append("<DepthMapControl.UseFixedContrastThresholdPercentile value=\"true\" />\r",t); File.append("<FileIO.UseExternalTIFFReader value=\"false\" />\r",t); File.append("<OutputImageNaming.Template value=\"{datetime} ZS {method}\" />\r",t); File.append("<Prerotation.Degrees value=\"0\" />\r",t); File.append("<Prerotation.Selected value=\"false\" />\r",t); File.append("<Presize.UserSetting.Scale value=\"1.0\" />\r",t); File.append("<Presize.UserSetting.Selected value=\"false\" />\r",t); File.append("<Presize.Working.Scale value=\"1.0\" />\r",t); File.append("<PyramidControl.GritSuppressionMethod value=\"1\" />\r",t); File.append("<PyramidControl.RetainUDRImage value=\"false\" />\r",t); File.append("<SaveImage.BitsPerColor value=\"16\" />\r",t); File.append("<SaveImage.CompressionQuality value=\"0.75\" />\r",t); File.append("<SaveImage.FileType value=\"tif\" />\r",t); File.append("<SaveImage.RescaleImageToAvoidOverflow value=\"false\" />\r",t); File.append("<SkewSequence.FirstImage.MaximumShiftXPct value=\"-3.0\" />\r",t); File.append("<SkewSequence.FirstImage.MaximumShiftYPct value=\"0.0\" />\r",t); File.append("<SkewSequence.LastImage.MaximumShiftXPct value=\"3.0\" />\r",t); File.append("<SkewSequence.LastImage.MaximumShiftYPct value=\"0.0\" />\r",t); File.append("<SkewSequence.NumberOfOutputImages value=\"3\" />\r",t); File.append("<SkewSequence.Selected value=\"false\" />\r",t); File.append("<StereoOrdering.LeftRightIndexSeparation value=\"1\" />\r",t); File.append("</Preferences>\r",t); File.append("<TaskIndicatorCode value=\"1\" />\r",t); File.append("</Task>\r",t); File.append("<Task>\r",t); File.append("<OutputImageDispositionCode value=\"4\" />\r",t); File.append("<OutputImagesDesignatedFolder value=\"C:\\Documents and Settings\\rswilson\\Desktop\\ImageJ\\Fusion Testing\\Method 2\\Prcies 430.2\\Sample 2\\Output\" />\r",t); File.append("<Preferences>\r",t); File.append("<AlignmentControl.AlignmentSettingsChanged value=\"false\" />\r",t); File.append("<AlignmentControl.AllowRotation value=\"true\" />\r",t); File.append("<AlignmentControl.AllowScale value=\"true\" />\r",t); File.append("<AlignmentControl.AllowShiftX value=\"true\" />\r",t); File.append("<AlignmentControl.AllowShiftY value=\"true\" />\r",t); File.append("<AlignmentControl.BrightnessSettingsChanged value=\"false\" />\r",t); File.append("<AlignmentControl.CorrectBrightness value=\"true\" />\r",t); File.append("<AlignmentControl.MaxRelDegRotation value=\"20.0\" />\r",t); File.append("<AlignmentControl.MaxRelPctScale value=\"20.0\" />\r",t); File.append("<AlignmentControl.MaxRelPctShiftX value=\"20.0\" />\r",t); File.append("<AlignmentControl.MaxRelPctShiftY value=\"20.0\" />\r",t); File.append("<AlignmentControl.Order.Automatic value=\"true\" />\r",t); File.append("<AlignmentControl.Order.NarrowFirst value=\"true\" />\r",t); File.append("<AllowReporting.UsageStatistics value=\"true\" />\r",t); File.append("<ColorManagement.InputOption value=\"Use_EXIF_and_DCF_rules\" />\r",t); File.append("<ColorManagement.InputOption.AssumedProfile value=\"sRGB IEC61966-2.1\" />\r",t); File.append("<ColorManagement.OutputOption value=\"CopyInput\" />\r",t); File.append("<DepthMapControl.ContrastThresholdLevel value=\"1.9073487E-7\" />\r",t); File.append("<DepthMapControl.ContrastThresholdPercentile value=\"0.0\" />\r",t); File.append("<DepthMapControl.EstimationRadius value=\"5\" />\r",t); File.append("<DepthMapControl.SmoothingRadius value=\"2\" />\r",t); File.append("<DepthMapControl.UseFixedContrastThresholdLevel value=\"false\" />\r",t); File.append("<DepthMapControl.UseFixedContrastThresholdPercentile value=\"true\" />\r",t); File.append("<FileIO.UseExternalTIFFReader value=\"false\" />\r",t); File.append("<OutputImageNaming.Template value=\"{datetime} ZS {method}\" />\r",t); File.append("<Prerotation.Degrees value=\"0\" />\r",t); File.append("<Prerotation.Selected value=\"false\" />\r",t); File.append("<Presize.UserSetting.Scale value=\"1.0\" />\r",t); File.append("<Presize.UserSetting.Selected value=\"false\" />\r",t); File.append("<Presize.Working.Scale value=\"1.0\" />\r",t); File.append("<PyramidControl.GritSuppressionMethod value=\"1\" />\r",t); File.append("<PyramidControl.RetainUDRImage value=\"false\" />\r",t); File.append("<SaveImage.BitsPerColor value=\"16\" />\r",t); File.append("<SaveImage.CompressionQuality value=\"0.75\" />\r",t); File.append("<SaveImage.FileType value=\"tif\" />\r",t); File.append("<SaveImage.RescaleImageToAvoidOverflow value=\"false\" />\r",t); File.append("<SkewSequence.FirstImage.MaximumShiftXPct value=\"-3.0\" />\r",t); File.append("<SkewSequence.FirstImage.MaximumShiftYPct value=\"0.0\" />\r",t); File.append("<SkewSequence.LastImage.MaximumShiftXPct value=\"3.0\" />\r",t); File.append("<SkewSequence.LastImage.MaximumShiftYPct value=\"0.0\" />\r",t); File.append("<SkewSequence.NumberOfOutputImages value=\"3\" />\r",t); File.append("<SkewSequence.Selected value=\"false\" />\r",t); File.append("<StereoOrdering.LeftRightIndexSeparation value=\"1\" />\r",t); File.append("</Preferences>\r",t); File.append("<TaskIndicatorCode value=\"2\" />\r",t); File.append("</Task>\r",t); File.append("</Tasks>\r",t); File.append("</Batch>\r",t); File.append("</Batches>\r",t); File.append("</BatchQueue>\r",t); File.append("</ZereneStackerBatchScript>\r",t); File.close(f); File.rename(t, x); |
In reply to this post by Wilson R S (AT)
19 jan 2010 kl. 11.52 skrev Wilson R S (AT):
> I there, tanks for that. > Is there an easier way for example outputting as a text file and then > renaming and altering the file extension? A XML file is just a text file so if you save it with the XML file-ending and have it corectly encoded it will be a XML-file // Tomas import java.io.*; import ij.*; import ij.io.*; import ij.plugin.*; import javax.xml.stream.*; public class Fio_ implements PlugIn { // public void run(String arg){ String fn,dn; // promt user for filename to save the file as SaveDialog s = new SaveDialog("Save the xml file as ","bla",".xml"); fn = s.getFileName(); dn = s.getDirectory(); fn = dn + fn; // Concatenate to get the full pathname // Write a Text file with XML statments - note that the quotes has to be handeled manualy try{ FileOutputStream fos = new FileOutputStream(fn); try{ OutputStreamWriter out = new OutputStreamWriter(fos, "UTF-8"); try{ out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); out.write("\t<ZereneStackerBatchScript>\n"); // And a loot more writes out.close(); // Write the buffer and close the file } catch(IOException e){ } } catch(java.io.UnsupportedEncodingException e){ // should abort the rest of the code } } catch (java.io.FileNotFoundException e){ // should abort the rest of the code } // Alternativly the propper way of writing a XML file fn = fn + "_2"; XMLOutputFactory xof = XMLOutputFactory.newInstance(); XMLStreamWriter xtw = null; try { try { xtw = xof.createXMLStreamWriter(new FileOutputStream(fn), "UTF-8"); xtw.writeStartDocument("utf-8","1.0"); xtw.writeCharacters("\n"); xtw.writeStartElement("ZereneStackerBatchScript"); xtw.writeCharacters("\n"); //... xtw.writeEndElement(); // closing ZereneStackerBatchScript xtw.writeEndDocument(); xtw.close(); } catch (XMLStreamException ex) { } } catch (FileNotFoundException ex) { } } } |
In reply to this post by Wilson R S (AT)
Dear Rod,
If you want full XML functionality you can look at the http://www.saxproject.org/. I think nowadays it is even part of the official Java SE. Otherwise you have to write your own parser. Best regards, Dimiter |
Prodanov Dimiter wrote:
> Dear Rod, > > If you want full XML functionality you can look at the http://www.saxproject.org/. I think nowadays it is even part of the official Java SE. Otherwise you have to write your own parser. > > Best regards, > > Dimiter > > Rod, as said above you are much better off using the built in XML packages since you then don't need extra jars on the classpath. (look at the org.w3c.dom. and org.xml.sax packages). They are based on the popular xerces and xalan packages from Apache. In the unlikely event that you want to update just the xml functionality you can place xerces and xalan in the lib/endorsed folder and they override the built in versions. Chris |
Free forum by Nabble | Edit this page |