International Color Consortium (ICC) files? - color-profile

I recently came to know of the ICC profile format. As part of a broader project I am working on, I need some source code of a few .icc files and their corresponding parse trees (or alternatively a .icc file parser).
I have searched the internet looking for the same and now I am thoroughly confused about the following concepts:
(1) Does a .icc file have source code? It's hard to enough to find a sample .icc file on the net, and the ones I found on github cannot open without the "Microsoft Color Control Panel" and that doesn't mention the source code.
(2) Once I have the source code, is their an existing parser to generate a parse tree for such a file?
By 'source code' I mean:
Following link displays an html file: https://en.wikipedia.org/wiki/Pythagorean_theorem
And it's source code looks sth like:
<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>Pythagorean theorem - Wikipedia</title>
<script>document.documentElement.className="client-js";RLCONF={"wgBreakFrames":!1,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"YA8lRQpAICgAADmJhZgAAABI","wgCSPNonce":!1,"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":!1,"wgNamespaceNumber":0,"wgPageName":"Pythagorean_theorem","wgTitle":"Pythagorean theorem","wgCurRevisionId":1000327432,"wgRevisionId":1000327432,"wgArticleId":26513034,"wgIsArticle":!0,"wgIsRedirect":!1,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Webarchive template wayback links","Articles with short description","Short description is different from Wikidata","Wikipedia indefinitely move-protected pages","Wikipedia indefinitely semi-protected pages","CS1: long volume value","Commons category link from Wikidata",
"Wikipedia articles with BNE identifiers","Wikipedia articles with BNF identifiers","Wikipedia articles with GND identifiers","Wikipedia articles with LCCN identifiers","Wikipedia articles with NDL identifiers","Good articles","Articles containing proofs","Pythagorean theorem","Area","Angle","Equations","Pythagoras","Euclidean plane geometry","History of geometry","Proof without words"],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Pythagorean_theorem","wgRelevantArticleId":26513034,"wgIsProbablyEditable":!1,"wgRelevantPageIsProbablyEditable":!1,"wgRestrictionEdit":["autoconfirmed"],"wgRestrictionMove":["sysop"],"wgMediaViewerOnClick":!0,"wgMediaViewerEnabledByDefault":!0,"wgPopupsReferencePreviews":!1,"wgPopupsConflictsWithNavPopupGadget":!1,"wgPopupsConflictsWithRefTooltipsGadget":!0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":!0,
"nearby
....

.icc files do not have a "source code" in the sense in which people normally use the term "source code". You might say, the .icc file is the source code, and it is interpreted by software that does something about images.
So if you have the .icc file, then you have the source code.
You probably have some .icc files on your computer, e.g. (from www.colourmanagement.net):
ubuntu: /usr/share/color/icc
windows: \system32\spool\drivers\color
mac: /Library/ColorSync/Profiles or /Users/<username>/Library/ColorSync/Profiles
The ICC file format is ... well, a file format, like JPG or WAV. It's a sequence of bytes. I found the ICC Specification here on the page ICC Specifications.
To load and inspect a .icc file from an own program, I assume there are libraries for some programming languages. It seems that the ICC provides some themselves.

Related

How to load Dicom data into simple ITK

I try to load PET/CT data (folder available in https://wwsi365-my.sharepoint.com/:f:/g/personal/s9956jm_ms_wwsi_edu_pl/EkoL7bs8rvxLq7-YHminlA0Bhc0PBY5_rG3zwMI2coHUAQ?e=TuekJa) - file can be opened via slicer for example so is not corrupted, but when I try to load it via simpleitk in python code below- I get error
code
dirOfExample
="C:\\Users\\1\\Downloads\\bad45Y\\bad45Y\\DICOM\\21071306"
reader = sitk.ImageSeriesReader()
dicom_names = reader.GetGDCMSeriesFileNames(dirOfExample)
reader.SetFileNames(dicom_names)
error
WARNING: In D:\a\1\sitk-build\ITK\Modules\IO\GDCM\src\itkGDCMSeriesFileNames.cxx, line 113
GDCMSeriesFileNames (00000000679B0CC0): No Series can be found, make sure your restrictions are not too strong
Thanks for help!
It looks like your DICOM files are down within some sub-directories of "21071306". The SimpleITK ImageSeriesReader is only going to look for DICOM image files within the directory that you give it. It does not do a recursive search of the sub-directories.

slidify lectureSite: workflow and customizations

I am getting started with http://slidify.github.io/lectureSite/. I like the idea and the template very much. However, being new to this, I am struggling with customization.
Let me first explain what this 'lectureSite' architecture offers. The main code is based on rmarkdown and slidify and the customizations of the layout are mainly controlled in css files. The 'lectureSite' consists of an html webpage that serves as a contents page and starting point to access different slides ('lectures'), much of it created automagically. It looks as great as it sounds!
Each lecture is stored in a separate directory with its own 'assets' directory. So in a course made of 10 lectures, one has 10 directories, each with its own css and js. However, to achieve a common style for the whole course, one would like most of the customizations to be shared among all the lectures. My main problem is how to deal with this.
Question: How should I deal with the css customizations that I would like to share among all the lectures?
I have been successful in customizing each lecture by inserting the css code into each rmarkdown file between <style> and </style> tags, but now I would like to take the customizations to a place where they may be shared. I expected that by including a slidify.css file inside assets/css the styles would be picked up, but they are not: could I be doing something wrong or was my expectation incorrect to begin with? And besides, there are so many of those assets/css directories that it would be tedious to have to copy the css into each every time it is modified. Is there a mechanism to set a single css file that would override the css inside assets/css?
I also tried to make a 'declaration' at the top of the rmarkdown file (something I saw there: http://rmarkdown.rstudio.com/html_document_format.html) with:
css : slidify.css
but that gave the following error message:
pandoc: Could not fetch slidify.css
slidify.css: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 67
Execution halted
An alternative would be to source() a text file with the customization between <style> and </style> tags. Are there any disadvantages to this approach? And btw what is the code for sourcing an external file from rmarkdown?
Consider the following structure:
assets -> put custom img/js/css/layout assets
lectures -> folder containing lectures
Lecture 01
Lecture 02
Lecture 03
libraries -> frameworks, highlighters and widgets
index.Rmd -> Rmd source for home page
site.yml -> Site related configuration
and suppose you are inside one of the Lectures index.Rmd files. I found the following seems to 'by-pass' the local assets directory to source the 'root' directory instead:
url : {lib: "../../libraries", assets: "../../assets"}
If you place your css files into "../../assets/css/custom.css", that is the 'master' assets directory at the top of the structure (at the root, to say it differently), then it will be sourced by slidify. I deleted all the other assets directories and didn't find it did any harm (all they contained to begin with was one single file ribbons.css). Not extensively tested, but it worked on Firefox and Chrome.
In this way, I can have a single customization css for all the chapters.
However, this structure appears to work only for the html5slides framework and not for io2012. For io2012 I explain here what I did (it worked for me, but I have no idea if it's the right way):
https://github.com/ramnathv/slidify/issues/409
Somewhat more involved. Hopefully future versions of slidify will make it easier. One problem with dumping style files into the root assets directory is that, with the html5slides framework, all files are sourced. So my idea of having framework-specific css files in the assets directory doesn't work, because the styles are all sourced and some overwrite one another. So keeping the custom css files in framework-specific directories is probably a better approach anyhow.
I also found the following way of sharing R customizations and knit opts (or whatever they're called)
```{r 'preamble', message = FALSE, warning = FALSE, error = FALSE, echo = FALSE, tidy = FALSE, comment = NA, cache = FALSE} # probably several redundant ones in there
require(knitr)
opts_chunk$set(echo = FALSE, cache = FALSE) # example of knit options
source('../../shared/shared.R') # here I share common R code
```

Annotating Adobe Reader PDFs with math symbols

Many of the math textbooks and other literature I read is in PDF format, so I frequently find myself annotating these with the Adobe Reader comments tool.
I did find a helpful guide here, but sometimes I'd like the option of inserting math symbols, too. Has anyone found a reliable way to insert math symbols, TeX, or other arbitrary formatting into the annotations?
So far, the best I've come up with is to enter the unicode prefixed by "0x" and hit alt+X after it. Maybe with the Adobe javascript SDK you could write a script to shortcut this.
I don't think any of the current commercial editors make this easy, which is too bad. I am sure the vendors monitor this site, so there is hope.
In the meantime, here is a manual workaround.
Use tikz to create your comment boxes. Here are the two examples I found to be most relevant: Boxes and Positioning. Play around with the options to get both the shape and the placement you want. Generate a pdf file from the latex source that contains your comments.
IMPORTANT: if your comments end before the last page of the original document, insert:
\pagebreak{} % create empty page
\thispagestyle{empty} % get rid of page numbers et al
~ % put a space so the page gets generated
before your \end{document}, to get an empty last page. The following command will reuse the last page of your comments document on all subsequent pages of the original document.
Use a recent version of pdftk with the multistamp command to overlay your equations file with your original file like so:
pdftk original.pdf multistamp comments.pdf output out.pdf
Also see this question.
The free (as speech) PDF tool, Okular, supports this functionality by putting latex formula directly between $$...$$.

read .sas source code on osx without installing sas?

Plain and simple: is there a way to read (not run) .sas files on osx in order to rewrite old SAS programs in another language, e.g. R? Note I do not refer to reading sas data files – I know there are several ways, I am just interested in reading old SAS code.
.sas files containing SAS code should just be a text file. You can use any text editor that you like to open and modify these files. Since the system probably doesn't have .sas files associated with any particular program you can either use the "Open with" option when "right-clicking" on the file or you could open the editor first and then open the file from within the editor.
TextEdit will work. Another editor that I like is Komodo Edit.

Adding a external PDF as appendix with ReStructuredText

I'm writing a major report, and have two PDF files I'd like to include as appendices. The report is written using ReStructuredText, and rst2pdf will be used to convert it.
Does docutils or rst2pdf have any functionality for external files as appendices?
Docutils has the raw directive for passing data through to the final output untouched. In the documentation they demonstrate this for the LaTeX and HTML outputs. rst2pdf seems to support this directive: in the manual they use the raw directive to include some text/commands in the final PDF (see the section headed Raw Directive) but they do not demonstrate using this directive for including external PDF files.
If rst2pdf does support this feature, you should just be able to use:
.. raw:: pdf
:file: your_pdf_file.pdf
:encoding: the encoding of the PDF file, if different from the
reStructuredText document's encoding.
I have just had a go at doing this (if in doubt, give it a go) and I get a number of UnicodeDecodeErrors, so the feature seems to be supported but I can't get it to work.
You could embed PDFs as images, but that makes no sense for appendixes.
If you only have those files as PDF, you can add them using a PDF manipulation tool, but those usually break page numbering or links or some other piece of the PDFs.
In the end, I couldn't fix this problem directly. I converted the ReStructuredText file to Latex, and included the appendices there.

Resources